Namespace dawn/common/ and dawn/utils/ in dawn::
Only Constants.h remains in no namespace; but it may be addressed in the future as well. Bug: dawn:302 Change-Id: Ib9b9ab4b974ad1de1bb9f2302f4d24d8216f55e4 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132841 Kokoro: Austin Eng <enga@chromium.org> Auto-Submit: Austin Eng <enga@chromium.org> Reviewed-by: Loko Kung <lokokung@google.com> Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
parent
0bb1bb3067
commit
2731b76ded
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "dawn/common/Assert.h"
|
||||
|
||||
namespace gpu_info {
|
||||
namespace dawn::gpu_info {
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -151,4 +151,4 @@ std::string GetArchitectureName(PCIVendorID vendorId, PCIDeviceID deviceId) {
|
|||
return "";
|
||||
}
|
||||
|
||||
} // namespace gpu_info
|
||||
} // namespace dawn::gpu_info
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
using PCIVendorID = uint32_t;
|
||||
using PCIDeviceID = uint32_t;
|
||||
|
||||
namespace gpu_info {
|
||||
namespace dawn::gpu_info {
|
||||
|
||||
// Vendor IDs
|
||||
{% for vendor in vendors %}
|
||||
|
@ -51,5 +51,5 @@ namespace gpu_info {
|
|||
std::string GetVendorName(PCIVendorID vendorId);
|
||||
std::string GetArchitectureName(PCIVendorID vendorId, PCIDeviceID deviceId);
|
||||
|
||||
} // namespace gpu_info
|
||||
} // namespace dawn::gpu_info
|
||||
#endif // SRC_DAWN_COMMON_GPUINFO_AUTOGEN_H_
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
#include <cstddef>
|
||||
#include <new>
|
||||
|
||||
namespace dawn {
|
||||
|
||||
template <typename T>
|
||||
T* AllocNoThrow(size_t count) {
|
||||
#if defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER)
|
||||
|
@ -30,4 +32,6 @@ T* AllocNoThrow(size_t count) {
|
|||
return new (std::nothrow) T[count];
|
||||
}
|
||||
|
||||
} // namespace dawn
|
||||
|
||||
#endif // SRC_DAWN_COMMON_ALLOC_H_
|
||||
|
|
|
@ -19,6 +19,12 @@
|
|||
#include "dawn/common/Log.h"
|
||||
#include "dawn/common/Platform.h"
|
||||
|
||||
#if DAWN_COMPILER_IS(MSVC)
|
||||
extern void __cdecl __debugbreak(void);
|
||||
#endif
|
||||
|
||||
namespace dawn {
|
||||
|
||||
#if DAWN_COMPILER_IS(CLANG) || DAWN_COMPILER_IS(GCC)
|
||||
void BreakPoint() {
|
||||
#if DAWN_PLATFORM_IS(X86)
|
||||
|
@ -43,7 +49,6 @@ void BreakPoint() {
|
|||
}
|
||||
|
||||
#elif DAWN_COMPILER_IS(MSVC)
|
||||
extern void __cdecl __debugbreak(void);
|
||||
void BreakPoint() {
|
||||
__debugbreak();
|
||||
}
|
||||
|
@ -64,3 +69,5 @@ void HandleAssertionFailure(const char* file,
|
|||
BreakPoint();
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace dawn
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#define DAWN_ASSERT_CALLSITE_HELPER(file, func, line, condition) \
|
||||
do { \
|
||||
if (!(condition)) { \
|
||||
HandleAssertionFailure(file, func, line, #condition); \
|
||||
dawn::HandleAssertionFailure(file, func, line, #condition); \
|
||||
} \
|
||||
} while (DAWN_ASSERT_LOOP_CONDITION)
|
||||
#else
|
||||
|
@ -72,9 +72,13 @@
|
|||
#define UNREACHABLE DAWN_UNREACHABLE
|
||||
#endif
|
||||
|
||||
namespace dawn {
|
||||
|
||||
void HandleAssertionFailure(const char* file,
|
||||
const char* function,
|
||||
int line,
|
||||
const char* condition);
|
||||
|
||||
} // namespace dawn
|
||||
|
||||
#endif // SRC_DAWN_COMMON_ASSERT_H_
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
#include "dawn/common/Math.h"
|
||||
#include "dawn/common/UnderlyingType.h"
|
||||
|
||||
namespace dawn {
|
||||
|
||||
// This is ANGLE's BitSetIterator class with a customizable return type.
|
||||
// Types have been updated to be more specific.
|
||||
// TODO(crbug.com/dawn/306): it could be optimized, in particular when N <= 64
|
||||
|
@ -131,4 +133,6 @@ BitSetIterator<N, uint32_t> IterateBitSet(const std::bitset<N>& bitset) {
|
|||
return BitSetIterator<N, uint32_t>(bitset);
|
||||
}
|
||||
|
||||
} // namespace dawn
|
||||
|
||||
#endif // SRC_DAWN_COMMON_BITSETITERATOR_H_
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
#include "dawn/common/NonCopyable.h"
|
||||
|
||||
namespace dawn {
|
||||
|
||||
template <typename T>
|
||||
class ConcurrentCache : public NonMovable {
|
||||
public:
|
||||
|
@ -51,4 +53,6 @@ class ConcurrentCache : public NonMovable {
|
|||
std::unordered_set<T*, typename T::HashFunc, typename T::EqualityFunc> mCache;
|
||||
};
|
||||
|
||||
} // namespace dawn
|
||||
|
||||
#endif // SRC_DAWN_COMMON_CONCURRENTCACHE_H_
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
#include "dawn/common/RefBase.h"
|
||||
|
||||
namespace dawn {
|
||||
|
||||
template <typename T>
|
||||
struct CoreFoundationRefTraits {
|
||||
static constexpr T kNullValue = nullptr;
|
||||
|
@ -39,4 +41,6 @@ CFRef<T> AcquireCFRef(T pointee) {
|
|||
return ref;
|
||||
}
|
||||
|
||||
} // namespace dawn
|
||||
|
||||
#endif // SRC_DAWN_COMMON_COREFOUNDATIONREF_H_
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
#include "dawn/common/Platform.h"
|
||||
|
||||
namespace dawn {
|
||||
|
||||
#if DAWN_PLATFORM_IS(WINDOWS)
|
||||
#include "dawn/common/windows_with_undefs.h"
|
||||
#if DAWN_PLATFORM_IS(WINUWP)
|
||||
|
@ -106,3 +108,5 @@ void* DynamicLib::GetProc(const std::string& procName, std::string* error) const
|
|||
|
||||
return proc;
|
||||
}
|
||||
|
||||
} // namespace dawn
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
#include "dawn/common/Assert.h"
|
||||
|
||||
namespace dawn {
|
||||
|
||||
class DynamicLib {
|
||||
public:
|
||||
DynamicLib() = default;
|
||||
|
@ -51,4 +53,6 @@ class DynamicLib {
|
|||
void* mHandle = nullptr;
|
||||
};
|
||||
|
||||
} // namespace dawn
|
||||
|
||||
#endif // SRC_DAWN_COMMON_DYNAMICLIB_H_
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "dawn/common/Assert.h"
|
||||
|
||||
namespace gpu_info {
|
||||
namespace dawn::gpu_info {
|
||||
namespace {
|
||||
// Intel
|
||||
// Referenced from the following Mesa source code:
|
||||
|
@ -105,4 +105,4 @@ bool IsSkylake(PCIDeviceID deviceId) {
|
|||
return std::find(Skylake.cbegin(), Skylake.cend(), deviceId) != Skylake.cend();
|
||||
}
|
||||
|
||||
} // namespace gpu_info
|
||||
} // namespace dawn::gpu_info
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "dawn/common/GPUInfo_autogen.h"
|
||||
#include "dawn/common/StackContainer.h"
|
||||
|
||||
namespace gpu_info {
|
||||
namespace dawn::gpu_info {
|
||||
|
||||
// Four uint16 fields could cover almost all driver version schemas:
|
||||
// D3D12: AA.BB.CCC.DDDD
|
||||
|
@ -61,5 +61,5 @@ int CompareIntelMesaDriverVersion(const DriverVersion& version1, const DriverVer
|
|||
// Intel architectures
|
||||
bool IsSkylake(PCIDeviceID deviceId);
|
||||
|
||||
} // namespace gpu_info
|
||||
} // namespace dawn::gpu_info
|
||||
#endif // SRC_DAWN_COMMON_GPUINFO_H_
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
#include "dawn/common/TypedInteger.h"
|
||||
#include "dawn/common/ityp_bitset.h"
|
||||
|
||||
namespace dawn {
|
||||
|
||||
// Wrapper around std::hash to make it a templated function instead of a functor. It is marginally
|
||||
// nicer, and avoids adding to the std namespace to add hashing of other types.
|
||||
template <typename T>
|
||||
|
@ -88,12 +90,14 @@ size_t Hash(const std::bitset<N>& value) {
|
|||
}
|
||||
#endif
|
||||
|
||||
} // namespace dawn
|
||||
|
||||
namespace std {
|
||||
template <typename Index, size_t N>
|
||||
struct hash<ityp::bitset<Index, N>> {
|
||||
struct hash<dawn::ityp::bitset<Index, N>> {
|
||||
public:
|
||||
size_t operator()(const ityp::bitset<Index, N>& value) const {
|
||||
return Hash(static_cast<const std::bitset<N>&>(value));
|
||||
size_t operator()(const dawn::ityp::bitset<Index, N>& value) const {
|
||||
return dawn::Hash(static_cast<const std::bitset<N>&>(value));
|
||||
}
|
||||
};
|
||||
} // namespace std
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
#include "dawn/common/RefBase.h"
|
||||
|
||||
namespace dawn {
|
||||
|
||||
template <typename T>
|
||||
struct IOKitRefTraits {
|
||||
static constexpr T kNullValue = IO_OBJECT_NULL;
|
||||
|
@ -39,4 +41,6 @@ IORef<T> AcquireIORef(T pointee) {
|
|||
return ref;
|
||||
}
|
||||
|
||||
} // namespace dawn
|
||||
|
||||
#endif // SRC_DAWN_COMMON_IOKITREF_H_
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
#include "dawn/common/Assert.h"
|
||||
|
||||
namespace dawn {
|
||||
|
||||
// Simple LinkedList type. (See the Q&A section to understand how this
|
||||
// differs from std::list).
|
||||
//
|
||||
|
@ -247,4 +249,6 @@ LinkedListIterator<T> end(LinkedList<T>& l) {
|
|||
return LinkedListIterator<T>(l.tail()->next());
|
||||
}
|
||||
|
||||
} // namespace dawn
|
||||
|
||||
#endif // SRC_DAWN_COMMON_LINKEDLIST_H_
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#include <intrin.h>
|
||||
#endif
|
||||
|
||||
namespace dawn {
|
||||
|
||||
uint32_t ScanForward(uint32_t bits) {
|
||||
ASSERT(bits != 0);
|
||||
#if DAWN_COMPILER_IS(MSVC)
|
||||
|
@ -162,3 +164,5 @@ uint64_t RoundUp(uint64_t n, uint64_t m) {
|
|||
ASSERT(m <= std::numeric_limits<uint64_t>::max() - n);
|
||||
return ((n + m - 1) / m) * m;
|
||||
}
|
||||
|
||||
} // namespace dawn
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
|
||||
#include "dawn/common/Assert.h"
|
||||
|
||||
namespace dawn {
|
||||
|
||||
// The following are not valid for 0
|
||||
uint32_t ScanForward(uint32_t bits);
|
||||
uint32_t Log2(uint32_t value);
|
||||
|
@ -125,4 +127,6 @@ constexpr bool IsSubset(T1 subset, T2 set) {
|
|||
return bitsAlsoInSet == subset;
|
||||
}
|
||||
|
||||
} // namespace dawn
|
||||
|
||||
#endif // SRC_DAWN_COMMON_MATH_H_
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#error "NSRef can only be used in Objective C/C++ code."
|
||||
#endif
|
||||
|
||||
namespace dawn {
|
||||
|
||||
// This file contains smart pointers that automatically reference and release Objective C objects
|
||||
// and prototocals in a manner very similar to Ref<>. Note that NSRef<> and NSPRef's constructor add
|
||||
// a reference to the object by default, so the pattern to get a reference for a newly created
|
||||
|
@ -108,4 +110,6 @@ NSPRef<T> AcquireNSPRef(T pointee) {
|
|||
return ref;
|
||||
}
|
||||
|
||||
} // namespace dawn
|
||||
|
||||
#endif // SRC_DAWN_COMMON_NSREF_H_
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
#ifndef SRC_DAWN_COMMON_NONCOPYABLE_H_
|
||||
#define SRC_DAWN_COMMON_NONCOPYABLE_H_
|
||||
|
||||
namespace dawn {
|
||||
|
||||
// A base class to make a class non-copyable.
|
||||
class NonCopyable {
|
||||
protected:
|
||||
|
@ -40,4 +42,6 @@ class NonMovable : NonCopyable {
|
|||
void operator=(NonMovable&&) = delete;
|
||||
};
|
||||
|
||||
} // namespace dawn
|
||||
|
||||
#endif // SRC_DAWN_COMMON_NONCOPYABLE_H_
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include "dawn/common/Assert.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace detail {
|
||||
|
||||
template <typename T>
|
||||
|
@ -81,4 +82,6 @@ bool RangesOverlap(T x0, T x1, T y0, T y1) {
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace dawn
|
||||
|
||||
#endif // SRC_DAWN_COMMON_NUMERIC_H_
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
#include <cstddef>
|
||||
|
||||
namespace dawn {
|
||||
|
||||
class PlacementAllocated {
|
||||
public:
|
||||
// Delete the default new operator so this can only be created with placement new.
|
||||
|
@ -39,4 +41,6 @@ class PlacementAllocated {
|
|||
}
|
||||
};
|
||||
|
||||
} // namespace dawn
|
||||
|
||||
#endif // SRC_DAWN_COMMON_PLACEMENTALLOCATED_H_
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
#include "dawn/common/Assert.h"
|
||||
#include "dawn/common/Compiler.h"
|
||||
|
||||
namespace dawn {
|
||||
|
||||
// A common class for various smart-pointers acting on referenceable/releasable pointer-like
|
||||
// objects. Logic for each specialization can be customized using a Traits type that looks
|
||||
// like the following:
|
||||
|
@ -162,4 +164,6 @@ class RefBase {
|
|||
T mValue;
|
||||
};
|
||||
|
||||
} // namespace dawn
|
||||
|
||||
#endif // SRC_DAWN_COMMON_REFBASE_H_
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
|
||||
#include "dawn/common/Assert.h"
|
||||
|
||||
namespace dawn {
|
||||
|
||||
static constexpr size_t kPayloadBits = 1;
|
||||
static constexpr uint64_t kPayloadMask = (uint64_t(1) << kPayloadBits) - 1;
|
||||
static constexpr uint64_t kRefCountIncrement = (uint64_t(1) << kPayloadBits);
|
||||
|
@ -121,3 +123,5 @@ void RefCounted::DeleteThis() {
|
|||
void RefCounted::LockAndDeleteThis() {
|
||||
DeleteThis();
|
||||
}
|
||||
|
||||
} // namespace dawn
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
#include "dawn/common/RefBase.h"
|
||||
|
||||
namespace dawn {
|
||||
|
||||
class RefCount {
|
||||
public:
|
||||
// Create a refcount with a payload. The refcount starts initially at one.
|
||||
|
@ -88,4 +90,6 @@ Ref<T> AcquireRef(T* pointee) {
|
|||
return ref;
|
||||
}
|
||||
|
||||
} // namespace dawn
|
||||
|
||||
#endif // SRC_DAWN_COMMON_REFCOUNTED_H_
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
#include "dawn/common/Result.h"
|
||||
|
||||
namespace dawn {
|
||||
|
||||
// Implementation details of the tagged pointer Results
|
||||
namespace detail {
|
||||
|
||||
|
@ -28,3 +30,4 @@ PayloadType GetPayloadType(intptr_t payload) {
|
|||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace dawn
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include "dawn/common/Assert.h"
|
||||
#include "dawn/common/Compiler.h"
|
||||
|
||||
namespace dawn {
|
||||
|
||||
// Result<T, E> is the following sum type (Haskell notation):
|
||||
//
|
||||
// data Result T E = Success T | Error E | Empty
|
||||
|
@ -511,4 +513,6 @@ std::unique_ptr<E> Result<T, E>::AcquireError() {
|
|||
return std::move(mError);
|
||||
}
|
||||
|
||||
} // namespace dawn
|
||||
|
||||
#endif // SRC_DAWN_COMMON_RESULT_H_
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
#include "dawn/common/SerialStorage.h"
|
||||
|
||||
namespace dawn {
|
||||
|
||||
template <typename Serial, typename Value>
|
||||
class SerialMap;
|
||||
|
||||
|
@ -74,4 +76,6 @@ void SerialMap<Serial, Value>::Enqueue(std::vector<Value>&& values, Serial seria
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace dawn
|
||||
|
||||
#endif // SRC_DAWN_COMMON_SERIALMAP_H_
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
#include "dawn/common/SerialStorage.h"
|
||||
|
||||
namespace dawn {
|
||||
|
||||
template <typename Serial, typename Value>
|
||||
class SerialQueue;
|
||||
|
||||
|
@ -83,4 +85,6 @@ void SerialQueue<Serial, Value>::Enqueue(std::vector<Value>&& values, Serial ser
|
|||
this->mStorage.emplace_back(serial, std::move(values));
|
||||
}
|
||||
|
||||
} // namespace dawn
|
||||
|
||||
#endif // SRC_DAWN_COMMON_SERIALQUEUE_H_
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
#include "dawn/common/Assert.h"
|
||||
|
||||
namespace dawn {
|
||||
|
||||
template <typename T>
|
||||
struct SerialStorageTraits {};
|
||||
|
||||
|
@ -315,4 +317,6 @@ const typename SerialStorage<Derived>::Value& SerialStorage<Derived>::ConstItera
|
|||
return *mSerialIterator;
|
||||
}
|
||||
|
||||
} // namespace dawn
|
||||
|
||||
#endif // SRC_DAWN_COMMON_SERIALSTORAGE_H_
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
#include "dawn/common/Assert.h"
|
||||
#include "dawn/common/Math.h"
|
||||
|
||||
namespace dawn {
|
||||
|
||||
// IndexLinkNode
|
||||
|
||||
SlabAllocatorImpl::IndexLinkNode::IndexLinkNode(Index index, Index nextIndex)
|
||||
|
@ -241,3 +243,5 @@ void SlabAllocatorImpl::GetNewSlab() {
|
|||
|
||||
mAvailableSlabs.Prepend(new (alignedPtr) Slab(allocation, node));
|
||||
}
|
||||
|
||||
} // namespace dawn
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
#include "dawn/common/Numeric.h"
|
||||
#include "dawn/common/PlacementAllocated.h"
|
||||
|
||||
namespace dawn {
|
||||
|
||||
// The SlabAllocator allocates objects out of one or more fixed-size contiguous "slabs" of memory.
|
||||
// This makes it very quick to allocate and deallocate fixed-size objects because the allocator only
|
||||
// needs to index an offset into pre-allocated memory. It is similar to a pool-allocator that
|
||||
|
@ -179,4 +181,6 @@ class SlabAllocator : public SlabAllocatorImpl {
|
|||
void Deallocate(T* object) { SlabAllocatorImpl::Deallocate(object); }
|
||||
};
|
||||
|
||||
} // namespace dawn
|
||||
|
||||
#endif // SRC_DAWN_COMMON_SLABALLOCATOR_H_
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
#include "dawn/common/Compiler.h"
|
||||
|
||||
namespace dawn {
|
||||
|
||||
// This allocator can be used with STL containers to provide a stack buffer
|
||||
// from which to allocate memory and overflows onto the heap. This stack buffer
|
||||
// would be allocated on the stack and allows us to avoid heap operations in
|
||||
|
@ -235,4 +237,6 @@ class StackVector
|
|||
StackVector& operator=(StackVector&& rhs) = delete;
|
||||
};
|
||||
|
||||
} // namespace dawn
|
||||
|
||||
#endif // SRC_DAWN_COMMON_STACKCONTAINER_H_
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
|
||||
#include <array>
|
||||
|
||||
namespace dawn {
|
||||
|
||||
#if DAWN_PLATFORM_IS(WINDOWS)
|
||||
const char* GetPathSeparator() {
|
||||
return "\\";
|
||||
|
@ -228,3 +230,5 @@ bool ScopedEnvironmentVar::Set(const char* variableName, const char* value) {
|
|||
mIsSet = SetEnvironmentVar(variableName, value);
|
||||
return mIsSet;
|
||||
}
|
||||
|
||||
} // namespace dawn
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
#include "dawn/common/Platform.h"
|
||||
|
||||
namespace dawn {
|
||||
|
||||
const char* GetPathSeparator();
|
||||
// Returns a pair of the environment variable's value, and a boolean indicating whether the variable
|
||||
// was present.
|
||||
|
@ -55,4 +57,6 @@ class ScopedEnvironmentVar {
|
|||
bool mIsSet = false;
|
||||
};
|
||||
|
||||
} // namespace dawn
|
||||
|
||||
#endif // SRC_DAWN_COMMON_SYSTEMUTILS_H_
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
#import <Foundation/NSProcessInfo.h>
|
||||
|
||||
namespace dawn {
|
||||
|
||||
void GetMacOSVersion(int32_t* majorVersion, int32_t* minorVersion) {
|
||||
NSOperatingSystemVersion version = [[NSProcessInfo processInfo] operatingSystemVersion];
|
||||
ASSERT(majorVersion != nullptr);
|
||||
|
@ -31,3 +33,5 @@ bool IsMacOSVersionAtLeast(uint32_t majorVersion, uint32_t minorVersion) {
|
|||
return
|
||||
[NSProcessInfo.processInfo isOperatingSystemAtLeastVersion:{majorVersion, minorVersion, 0}];
|
||||
}
|
||||
|
||||
} // namespace dawn
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
#include <type_traits>
|
||||
|
||||
namespace dawn {
|
||||
|
||||
template <typename LHS, typename RHS = LHS, typename T = void>
|
||||
struct HasEqualityOperator {
|
||||
static constexpr const bool value = false;
|
||||
|
@ -43,4 +45,6 @@ struct IsCString {
|
|||
static constexpr const bool value = Eval();
|
||||
};
|
||||
|
||||
} // namespace dawn
|
||||
|
||||
#endif // SRC_DAWN_COMMON_TYPETRAITS_H_
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
#include "dawn/common/Assert.h"
|
||||
#include "dawn/common/UnderlyingType.h"
|
||||
|
||||
namespace dawn {
|
||||
|
||||
// TypedInteger is helper class that provides additional type safety in Debug.
|
||||
// - Integers of different (Tag, BaseIntegerType) may not be used interoperably
|
||||
// - Allows casts only to the underlying type.
|
||||
|
@ -31,8 +33,8 @@
|
|||
// typedef of the underlying type.
|
||||
//
|
||||
// Example:
|
||||
// using UintA = TypedInteger<struct TypeA, uint32_t>;
|
||||
// using UintB = TypedInteger<struct TypeB, uint32_t>;
|
||||
// using UintA = dawn::TypedInteger<struct TypeA, uint32_t>;
|
||||
// using UintB = dawn::TypedInteger<struct TypeB, uint32_t>;
|
||||
//
|
||||
// in Release:
|
||||
// using UintA = uint32_t;
|
||||
|
@ -208,23 +210,24 @@ class alignas(T) TypedIntegerImpl {
|
|||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace dawn
|
||||
|
||||
namespace std {
|
||||
|
||||
template <typename Tag, typename T>
|
||||
class numeric_limits<detail::TypedIntegerImpl<Tag, T>> : public numeric_limits<T> {
|
||||
class numeric_limits<dawn::detail::TypedIntegerImpl<Tag, T>> : public numeric_limits<T> {
|
||||
public:
|
||||
static detail::TypedIntegerImpl<Tag, T> max() noexcept {
|
||||
return detail::TypedIntegerImpl<Tag, T>(std::numeric_limits<T>::max());
|
||||
static dawn::detail::TypedIntegerImpl<Tag, T> max() noexcept {
|
||||
return dawn::detail::TypedIntegerImpl<Tag, T>(std::numeric_limits<T>::max());
|
||||
}
|
||||
static detail::TypedIntegerImpl<Tag, T> min() noexcept {
|
||||
return detail::TypedIntegerImpl<Tag, T>(std::numeric_limits<T>::min());
|
||||
static dawn::detail::TypedIntegerImpl<Tag, T> min() noexcept {
|
||||
return dawn::detail::TypedIntegerImpl<Tag, T>(std::numeric_limits<T>::min());
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace std
|
||||
|
||||
namespace ityp {
|
||||
namespace dawn::ityp {
|
||||
|
||||
// These helpers below are provided since the default arithmetic operators for small integer
|
||||
// types like uint8_t and uint16_t return integers, not their same type. To avoid lots of
|
||||
|
@ -232,17 +235,19 @@ namespace ityp {
|
|||
// ityp::Sub(a, b) instead.
|
||||
|
||||
template <typename Tag, typename T>
|
||||
constexpr ::detail::TypedIntegerImpl<Tag, T> Add(::detail::TypedIntegerImpl<Tag, T> lhs,
|
||||
::detail::TypedIntegerImpl<Tag, T> rhs) {
|
||||
return ::detail::TypedIntegerImpl<Tag, T>(
|
||||
static_cast<T>(::detail::TypedIntegerImpl<Tag, T>::AddImpl(lhs, rhs)));
|
||||
constexpr ::dawn::detail::TypedIntegerImpl<Tag, T> Add(
|
||||
::dawn::detail::TypedIntegerImpl<Tag, T> lhs,
|
||||
::dawn::detail::TypedIntegerImpl<Tag, T> rhs) {
|
||||
return ::dawn::detail::TypedIntegerImpl<Tag, T>(
|
||||
static_cast<T>(::dawn::detail::TypedIntegerImpl<Tag, T>::AddImpl(lhs, rhs)));
|
||||
}
|
||||
|
||||
template <typename Tag, typename T>
|
||||
constexpr ::detail::TypedIntegerImpl<Tag, T> Sub(::detail::TypedIntegerImpl<Tag, T> lhs,
|
||||
::detail::TypedIntegerImpl<Tag, T> rhs) {
|
||||
return ::detail::TypedIntegerImpl<Tag, T>(
|
||||
static_cast<T>(::detail::TypedIntegerImpl<Tag, T>::SubImpl(lhs, rhs)));
|
||||
constexpr ::dawn::detail::TypedIntegerImpl<Tag, T> Sub(
|
||||
::dawn::detail::TypedIntegerImpl<Tag, T> lhs,
|
||||
::dawn::detail::TypedIntegerImpl<Tag, T> rhs) {
|
||||
return ::dawn::detail::TypedIntegerImpl<Tag, T>(
|
||||
static_cast<T>(::dawn::detail::TypedIntegerImpl<Tag, T>::SubImpl(lhs, rhs)));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
@ -255,6 +260,6 @@ constexpr std::enable_if_t<std::is_integral<T>::value, T> Sub(T lhs, T rhs) {
|
|||
return static_cast<T>(lhs - rhs);
|
||||
}
|
||||
|
||||
} // namespace ityp
|
||||
} // namespace dawn::ityp
|
||||
|
||||
#endif // SRC_DAWN_COMMON_TYPEDINTEGER_H_
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
#include <type_traits>
|
||||
|
||||
namespace dawn {
|
||||
|
||||
// UnderlyingType is similar to std::underlying_type_t. It is a passthrough for already
|
||||
// integer types which simplifies getting the underlying primitive type for an arbitrary
|
||||
// template parameter. It includes a specialization for detail::TypedIntegerImpl which yields
|
||||
|
@ -48,4 +50,6 @@ struct UnderlyingTypeImpl<TypedIntegerImpl<Tag, I>> {
|
|||
template <typename T>
|
||||
using UnderlyingType = typename detail::UnderlyingTypeImpl<T>::type;
|
||||
|
||||
} // namespace dawn
|
||||
|
||||
#endif // SRC_DAWN_COMMON_UNDERLYINGTYPE_H_
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
#include "dawn/common/windows_with_undefs.h"
|
||||
|
||||
namespace dawn {
|
||||
|
||||
std::string WCharToUTF8(const wchar_t* input) {
|
||||
// The -1 argument asks WideCharToMultiByte to use the null terminator to know the size of
|
||||
// input. It will return a size that includes the null terminator.
|
||||
|
@ -41,3 +43,5 @@ std::wstring UTF8ToWStr(const char* input) {
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace dawn
|
||||
|
|
|
@ -17,8 +17,12 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
namespace dawn {
|
||||
|
||||
std::string WCharToUTF8(const wchar_t* input);
|
||||
|
||||
std::wstring UTF8ToWStr(const char* input);
|
||||
|
||||
} // namespace dawn
|
||||
|
||||
#endif // SRC_DAWN_COMMON_WINDOWSUTILS_H_
|
||||
|
|
|
@ -24,16 +24,16 @@
|
|||
#include "dawn/common/TypedInteger.h"
|
||||
#include "dawn/common/UnderlyingType.h"
|
||||
|
||||
namespace ityp {
|
||||
namespace dawn::ityp {
|
||||
|
||||
// ityp::array is a helper class that wraps std::array with the restriction that
|
||||
// indices must be a particular type |Index|. Dawn uses multiple flat maps of
|
||||
// index-->data, and this class helps ensure an indices cannot be passed interchangably
|
||||
// to a flat map of a different type.
|
||||
template <typename Index, typename Value, size_t Size>
|
||||
class array : private std::array<Value, Size> {
|
||||
class array : private ::std::array<Value, Size> {
|
||||
using I = UnderlyingType<Index>;
|
||||
using Base = std::array<Value, Size>;
|
||||
using Base = ::std::array<Value, Size>;
|
||||
|
||||
static_assert(Size <= std::numeric_limits<I>::max());
|
||||
|
||||
|
@ -85,6 +85,6 @@ class array : private std::array<Value, Size> {
|
|||
using Base::front;
|
||||
};
|
||||
|
||||
} // namespace ityp
|
||||
} // namespace dawn::ityp
|
||||
|
||||
#endif // SRC_DAWN_COMMON_ITYP_ARRAY_H_
|
||||
|
|
|
@ -20,14 +20,15 @@
|
|||
#include "dawn/common/TypedInteger.h"
|
||||
#include "dawn/common/UnderlyingType.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace ityp {
|
||||
|
||||
// ityp::bitset is a helper class that wraps std::bitset with the restriction that
|
||||
// indices must be a particular type |Index|.
|
||||
template <typename Index, size_t N>
|
||||
class bitset : private std::bitset<N> {
|
||||
class bitset : private ::std::bitset<N> {
|
||||
using I = UnderlyingType<Index>;
|
||||
using Base = std::bitset<N>;
|
||||
using Base = ::std::bitset<N>;
|
||||
|
||||
static_assert(sizeof(I) <= sizeof(size_t));
|
||||
|
||||
|
@ -168,4 +169,6 @@ Index GetHighestBitIndexPlusOne(const ityp::bitset<Index, N>& bitset) {
|
|||
#endif // DAWN_COMPILER_IS(MSVC)
|
||||
}
|
||||
|
||||
} // namespace dawn
|
||||
|
||||
#endif // SRC_DAWN_COMMON_ITYP_BITSET_H_
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "dawn/common/TypedInteger.h"
|
||||
#include "dawn/common/UnderlyingType.h"
|
||||
|
||||
namespace ityp {
|
||||
namespace dawn::ityp {
|
||||
|
||||
// ityp::span is a helper class that wraps an unowned packed array of type |Value|.
|
||||
// It stores the size and pointer to first element. It has the restriction that
|
||||
|
@ -82,6 +82,6 @@ class span {
|
|||
Index mSize;
|
||||
};
|
||||
|
||||
} // namespace ityp
|
||||
} // namespace dawn::ityp
|
||||
|
||||
#endif // SRC_DAWN_COMMON_ITYP_SPAN_H_
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "dawn/common/StackContainer.h"
|
||||
#include "dawn/common/UnderlyingType.h"
|
||||
|
||||
namespace ityp {
|
||||
namespace dawn::ityp {
|
||||
|
||||
template <typename Index, typename Value, size_t StaticCapacity>
|
||||
class stack_vec : private StackVector<Value, StaticCapacity> {
|
||||
|
@ -72,6 +72,6 @@ class stack_vec : private StackVector<Value, StaticCapacity> {
|
|||
Index size() const { return Index(static_cast<I>(this->container().size())); }
|
||||
};
|
||||
|
||||
} // namespace ityp
|
||||
} // namespace dawn::ityp
|
||||
|
||||
#endif // SRC_DAWN_COMMON_ITYP_STACK_VEC_H_
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "dawn/common/TypedInteger.h"
|
||||
#include "dawn/common/UnderlyingType.h"
|
||||
|
||||
namespace ityp {
|
||||
namespace dawn::ityp {
|
||||
|
||||
// ityp::vector is a helper class that wraps std::vector with the restriction that
|
||||
// indices must be a particular type |Index|.
|
||||
|
@ -94,6 +94,6 @@ class vector : public std::vector<Value> {
|
|||
void reserve(Index size) { Base::reserve(static_cast<I>(size)); }
|
||||
};
|
||||
|
||||
} // namespace ityp
|
||||
} // namespace dawn::ityp
|
||||
|
||||
#endif // SRC_DAWN_COMMON_ITYP_VECTOR_H_
|
||||
|
|
|
@ -30,7 +30,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
|||
wgpu::AdapterProperties properties;
|
||||
adapter.GetProperties(&properties);
|
||||
|
||||
return gpu_info::IsGoogleSwiftshader(properties.vendorID, properties.deviceID);
|
||||
return dawn::gpu_info::IsGoogleSwiftshader(properties.vendorID, properties.deviceID);
|
||||
},
|
||||
true /* supportsErrorInjection */);
|
||||
}
|
||||
|
|
|
@ -102,7 +102,8 @@ int Run(const fuzzing::Program& program, bool (*AdapterSupported)(const dawn::na
|
|||
std::unique_ptr<dawn::wire::WireServer> wireServer(new dawn_wire::WireServer(serverDesc));
|
||||
wireServer->InjectInstance(sInstance->Get(), kInstanceObjectId, 0);
|
||||
|
||||
static utils::TerribleCommandBuffer* mCommandBuffer = new utils::TerribleCommandBuffer();
|
||||
static dawn::utilsTerribleCommandBuffer* mCommandBuffer =
|
||||
new dawn::utilsTerribleCommandBuffer();
|
||||
static dawn::wire::ChunkedCommandSerializer mSerializer =
|
||||
dawn::wire::ChunkedCommandSerializer(mCommandBuffer);
|
||||
mCommandBuffer->SetHandler(wireServer.get());
|
||||
|
|
|
@ -17,8 +17,10 @@
|
|||
|
||||
#include <cstdint>
|
||||
|
||||
namespace dawn {
|
||||
template <typename T>
|
||||
class Ref;
|
||||
} // namespace dawn
|
||||
|
||||
namespace dawn::native {
|
||||
|
||||
|
|
|
@ -164,8 +164,8 @@ class Stream<T, std::enable_if_t<std::is_enum_v<T>>> {
|
|||
|
||||
// Stream specialization for TypedInteger.
|
||||
template <typename Tag, typename Integer>
|
||||
class Stream<::detail::TypedIntegerImpl<Tag, Integer>> {
|
||||
using T = ::detail::TypedIntegerImpl<Tag, Integer>;
|
||||
class Stream<::dawn::detail::TypedIntegerImpl<Tag, Integer>> {
|
||||
using T = ::dawn::detail::TypedIntegerImpl<Tag, Integer>;
|
||||
|
||||
public:
|
||||
static void Write(Sink* s, const T& t) { StreamIn(s, static_cast<Integer>(t)); }
|
||||
|
|
|
@ -20,7 +20,9 @@
|
|||
|
||||
#include "dawn/native/Error.h"
|
||||
|
||||
namespace dawn {
|
||||
class DynamicLib;
|
||||
} // namespace dawn
|
||||
|
||||
namespace dawn::native::vulkan {
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "dawn/native/dawn_platform.h"
|
||||
#include "dawn/native/webgpu_absl_format_autogen.h"
|
||||
|
||||
namespace ityp {
|
||||
namespace dawn::ityp {
|
||||
template <typename Index, typename Value>
|
||||
class span;
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ void init() {
|
|||
queue = device.GetQueue();
|
||||
swapchain = GetSwapChain();
|
||||
|
||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||
wgpu::ShaderModule vsModule = dawn::utils::CreateShaderModule(device, R"(
|
||||
struct Constants {
|
||||
scale : f32,
|
||||
time : f32,
|
||||
|
@ -112,16 +112,16 @@ void init() {
|
|||
return output;
|
||||
})");
|
||||
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||
wgpu::ShaderModule fsModule = dawn::utils::CreateShaderModule(device, R"(
|
||||
@fragment fn main(@location(0) v_color : vec4f) -> @location(0) vec4f {
|
||||
return v_color;
|
||||
})");
|
||||
|
||||
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
|
||||
wgpu::BindGroupLayout bgl = dawn::utils::MakeBindGroupLayout(
|
||||
device, {{0, wgpu::ShaderStage::Vertex, wgpu::BufferBindingType::Uniform, true}});
|
||||
|
||||
utils::ComboRenderPipelineDescriptor descriptor;
|
||||
descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
|
||||
dawn::utils::ComboRenderPipelineDescriptor descriptor;
|
||||
descriptor.layout = dawn::utils::MakeBasicPipelineLayout(device, &bgl);
|
||||
descriptor.vertex.module = vsModule;
|
||||
descriptor.cFragment.module = fsModule;
|
||||
descriptor.cTargets[0].format = GetPreferredSwapChainTextureFormat();
|
||||
|
@ -143,7 +143,7 @@ void init() {
|
|||
bufferDesc.usage = wgpu::BufferUsage::CopyDst | wgpu::BufferUsage::Uniform;
|
||||
ubo = device.CreateBuffer(&bufferDesc);
|
||||
|
||||
bindGroup = utils::MakeBindGroup(device, bgl, {{0, ubo, 0, sizeof(ShaderData)}});
|
||||
bindGroup = dawn::utils::MakeBindGroup(device, bgl, {{0, ubo, 0, sizeof(ShaderData)}});
|
||||
}
|
||||
|
||||
int frameCount = 0;
|
||||
|
@ -155,7 +155,7 @@ void frame() {
|
|||
}
|
||||
queue.WriteBuffer(ubo, 0, shaderData.data(), kNumTriangles * sizeof(ShaderData));
|
||||
|
||||
utils::ComboRenderPassDescriptor renderPass({backbufferView});
|
||||
dawn::utils::ComboRenderPassDescriptor renderPass({backbufferView});
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
{
|
||||
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
|
||||
|
@ -182,10 +182,10 @@ int main(int argc, const char* argv[]) {
|
|||
}
|
||||
init();
|
||||
|
||||
utils::Timer* timer = utils::CreateTimer();
|
||||
dawn::utils::Timer* timer = dawn::utils::CreateTimer();
|
||||
timer->Start();
|
||||
while (!ShouldQuit()) {
|
||||
utils::ScopedAutoreleasePool pool;
|
||||
dawn::utils::ScopedAutoreleasePool pool;
|
||||
ProcessEvents();
|
||||
frameCount++;
|
||||
frame();
|
||||
|
|
|
@ -42,13 +42,13 @@ void init() {
|
|||
);
|
||||
return vec4f(pos[VertexIndex], 0.0, 1.0);
|
||||
})";
|
||||
WGPUShaderModule vsModule = utils::CreateShaderModule(device, vs).MoveToCHandle();
|
||||
WGPUShaderModule vsModule = dawn::utils::CreateShaderModule(device, vs).MoveToCHandle();
|
||||
|
||||
const char* fs = R"(
|
||||
@fragment fn main() -> @location(0) vec4f {
|
||||
return vec4f(1.0, 0.0, 0.0, 1.0);
|
||||
})";
|
||||
WGPUShaderModule fsModule = utils::CreateShaderModule(device, fs).MoveToCHandle();
|
||||
WGPUShaderModule fsModule = dawn::utils::CreateShaderModule(device, fs).MoveToCHandle();
|
||||
|
||||
{
|
||||
WGPURenderPipelineDescriptor descriptor = {};
|
||||
|
@ -142,9 +142,9 @@ int main(int argc, const char* argv[]) {
|
|||
init();
|
||||
|
||||
while (!ShouldQuit()) {
|
||||
utils::ScopedAutoreleasePool pool;
|
||||
dawn::utils::ScopedAutoreleasePool pool;
|
||||
ProcessEvents();
|
||||
frame();
|
||||
utils::USleep(16000);
|
||||
dawn::utils::USleep(16000);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,11 +65,11 @@ void initBuffers() {
|
|||
{0.00, 0.02},
|
||||
}};
|
||||
modelBuffer =
|
||||
utils::CreateBufferFromData(device, &model, sizeof(model), wgpu::BufferUsage::Vertex);
|
||||
dawn::utils::CreateBufferFromData(device, &model, sizeof(model), wgpu::BufferUsage::Vertex);
|
||||
|
||||
SimParams params = {0.04f, 0.1f, 0.025f, 0.025f, 0.02f, 0.05f, 0.005f, kNumParticles};
|
||||
updateParams =
|
||||
utils::CreateBufferFromData(device, ¶ms, sizeof(params), wgpu::BufferUsage::Uniform);
|
||||
updateParams = dawn::utils::CreateBufferFromData(device, ¶ms, sizeof(params),
|
||||
wgpu::BufferUsage::Uniform);
|
||||
|
||||
std::vector<Particle> initialParticles(kNumParticles);
|
||||
{
|
||||
|
@ -95,7 +95,7 @@ void initBuffers() {
|
|||
}
|
||||
|
||||
void initRender() {
|
||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||
wgpu::ShaderModule vsModule = dawn::utils::CreateShaderModule(device, R"(
|
||||
struct VertexIn {
|
||||
@location(0) a_particlePos : vec2f,
|
||||
@location(1) a_particleVel : vec2f,
|
||||
|
@ -112,7 +112,7 @@ void initRender() {
|
|||
}
|
||||
)");
|
||||
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||
wgpu::ShaderModule fsModule = dawn::utils::CreateShaderModule(device, R"(
|
||||
@fragment
|
||||
fn main() -> @location(0) vec4f {
|
||||
return vec4f(1.0, 1.0, 1.0, 1.0);
|
||||
|
@ -121,7 +121,7 @@ void initRender() {
|
|||
|
||||
depthStencilView = CreateDefaultDepthStencilView(device);
|
||||
|
||||
utils::ComboRenderPipelineDescriptor descriptor;
|
||||
dawn::utils::ComboRenderPipelineDescriptor descriptor;
|
||||
|
||||
descriptor.vertex.module = vsModule;
|
||||
descriptor.vertex.bufferCount = 2;
|
||||
|
@ -147,7 +147,7 @@ void initRender() {
|
|||
}
|
||||
|
||||
void initSim() {
|
||||
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
|
||||
wgpu::ShaderModule module = dawn::utils::CreateShaderModule(device, R"(
|
||||
struct Particle {
|
||||
pos : vec2f,
|
||||
vel : vec2f,
|
||||
|
@ -242,14 +242,14 @@ void initSim() {
|
|||
}
|
||||
)");
|
||||
|
||||
auto bgl = utils::MakeBindGroupLayout(
|
||||
auto bgl = dawn::utils::MakeBindGroupLayout(
|
||||
device, {
|
||||
{0, wgpu::ShaderStage::Compute, wgpu::BufferBindingType::Uniform},
|
||||
{1, wgpu::ShaderStage::Compute, wgpu::BufferBindingType::Storage},
|
||||
{2, wgpu::ShaderStage::Compute, wgpu::BufferBindingType::Storage},
|
||||
});
|
||||
|
||||
wgpu::PipelineLayout pl = utils::MakeBasicPipelineLayout(device, &bgl);
|
||||
wgpu::PipelineLayout pl = dawn::utils::MakeBasicPipelineLayout(device, &bgl);
|
||||
|
||||
wgpu::ComputePipelineDescriptor csDesc;
|
||||
csDesc.layout = pl;
|
||||
|
@ -258,7 +258,7 @@ void initSim() {
|
|||
updatePipeline = device.CreateComputePipeline(&csDesc);
|
||||
|
||||
for (uint32_t i = 0; i < 2; ++i) {
|
||||
updateBGs[i] = utils::MakeBindGroup(
|
||||
updateBGs[i] = dawn::utils::MakeBindGroup(
|
||||
device, bgl,
|
||||
{
|
||||
{0, updateParams, 0, sizeof(SimParams)},
|
||||
|
@ -281,7 +281,7 @@ wgpu::CommandBuffer createCommandBuffer(const wgpu::TextureView backbufferView,
|
|||
}
|
||||
|
||||
{
|
||||
utils::ComboRenderPassDescriptor renderPass({backbufferView}, depthStencilView);
|
||||
dawn::utils::ComboRenderPassDescriptor renderPass({backbufferView}, depthStencilView);
|
||||
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
|
||||
pass.SetPipeline(renderPipeline);
|
||||
pass.SetVertexBuffer(0, bufferDst);
|
||||
|
@ -322,9 +322,9 @@ int main(int argc, const char* argv[]) {
|
|||
init();
|
||||
|
||||
while (!ShouldQuit()) {
|
||||
utils::ScopedAutoreleasePool pool;
|
||||
dawn::utils::ScopedAutoreleasePool pool;
|
||||
ProcessEvents();
|
||||
frame();
|
||||
utils::USleep(16000);
|
||||
dawn::utils::USleep(16000);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,13 +41,13 @@ void initBuffers() {
|
|||
1,
|
||||
2,
|
||||
};
|
||||
indexBuffer =
|
||||
utils::CreateBufferFromData(device, indexData, sizeof(indexData), wgpu::BufferUsage::Index);
|
||||
indexBuffer = dawn::utils::CreateBufferFromData(device, indexData, sizeof(indexData),
|
||||
wgpu::BufferUsage::Index);
|
||||
|
||||
static const float vertexData[12] = {
|
||||
0.0f, 0.5f, 0.0f, 1.0f, -0.5f, -0.5f, 0.0f, 1.0f, 0.5f, -0.5f, 0.0f, 1.0f,
|
||||
};
|
||||
vertexBuffer = utils::CreateBufferFromData(device, vertexData, sizeof(vertexData),
|
||||
vertexBuffer = dawn::utils::CreateBufferFromData(device, vertexData, sizeof(vertexData),
|
||||
wgpu::BufferUsage::Vertex);
|
||||
}
|
||||
|
||||
|
@ -71,11 +71,12 @@ void initTextures() {
|
|||
data[i] = static_cast<uint8_t>(i % 253);
|
||||
}
|
||||
|
||||
wgpu::Buffer stagingBuffer = utils::CreateBufferFromData(
|
||||
wgpu::Buffer stagingBuffer = dawn::utils::CreateBufferFromData(
|
||||
device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc);
|
||||
wgpu::ImageCopyBuffer imageCopyBuffer =
|
||||
utils::CreateImageCopyBuffer(stagingBuffer, 0, 4 * 1024);
|
||||
wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(texture, 0, {0, 0, 0});
|
||||
dawn::utils::CreateImageCopyBuffer(stagingBuffer, 0, 4 * 1024);
|
||||
wgpu::ImageCopyTexture imageCopyTexture =
|
||||
dawn::utils::CreateImageCopyTexture(texture, 0, {0, 0, 0});
|
||||
wgpu::Extent3D copySize = {1024, 1024, 1};
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
|
@ -94,13 +95,13 @@ void init() {
|
|||
initBuffers();
|
||||
initTextures();
|
||||
|
||||
wgpu::ShaderModule vsModule = utils::CreateShaderModule(device, R"(
|
||||
wgpu::ShaderModule vsModule = dawn::utils::CreateShaderModule(device, R"(
|
||||
@vertex fn main(@location(0) pos : vec4f)
|
||||
-> @builtin(position) vec4f {
|
||||
return pos;
|
||||
})");
|
||||
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||
wgpu::ShaderModule fsModule = dawn::utils::CreateShaderModule(device, R"(
|
||||
@group(0) @binding(0) var mySampler: sampler;
|
||||
@group(0) @binding(1) var myTexture : texture_2d<f32>;
|
||||
|
||||
|
@ -109,18 +110,18 @@ void init() {
|
|||
return textureSample(myTexture, mySampler, FragCoord.xy / vec2f(640.0, 480.0));
|
||||
})");
|
||||
|
||||
auto bgl = utils::MakeBindGroupLayout(
|
||||
auto bgl = dawn::utils::MakeBindGroupLayout(
|
||||
device, {
|
||||
{0, wgpu::ShaderStage::Fragment, wgpu::SamplerBindingType::Filtering},
|
||||
{1, wgpu::ShaderStage::Fragment, wgpu::TextureSampleType::Float},
|
||||
});
|
||||
|
||||
wgpu::PipelineLayout pl = utils::MakeBasicPipelineLayout(device, &bgl);
|
||||
wgpu::PipelineLayout pl = dawn::utils::MakeBasicPipelineLayout(device, &bgl);
|
||||
|
||||
depthStencilView = CreateDefaultDepthStencilView(device);
|
||||
|
||||
utils::ComboRenderPipelineDescriptor descriptor;
|
||||
descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
|
||||
dawn::utils::ComboRenderPipelineDescriptor descriptor;
|
||||
descriptor.layout = dawn::utils::MakeBasicPipelineLayout(device, &bgl);
|
||||
descriptor.vertex.module = vsModule;
|
||||
descriptor.vertex.bufferCount = 1;
|
||||
descriptor.cBuffers[0].arrayStride = 4 * sizeof(float);
|
||||
|
@ -134,7 +135,7 @@ void init() {
|
|||
|
||||
wgpu::TextureView view = texture.CreateView();
|
||||
|
||||
bindGroup = utils::MakeBindGroup(device, bgl, {{0, sampler}, {1, view}});
|
||||
bindGroup = dawn::utils::MakeBindGroup(device, bgl, {{0, sampler}, {1, view}});
|
||||
}
|
||||
|
||||
struct {
|
||||
|
@ -149,7 +150,7 @@ void frame() {
|
|||
}
|
||||
|
||||
wgpu::TextureView backbufferView = swapchain.GetCurrentTextureView();
|
||||
utils::ComboRenderPassDescriptor renderPass({backbufferView}, depthStencilView);
|
||||
dawn::utils::ComboRenderPassDescriptor renderPass({backbufferView}, depthStencilView);
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
{
|
||||
|
@ -175,9 +176,9 @@ int main(int argc, const char* argv[]) {
|
|||
init();
|
||||
|
||||
while (!ShouldQuit()) {
|
||||
utils::ScopedAutoreleasePool pool;
|
||||
dawn::utils::ScopedAutoreleasePool pool;
|
||||
ProcessEvents();
|
||||
frame();
|
||||
utils::USleep(16000);
|
||||
dawn::utils::USleep(16000);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -136,7 +136,7 @@ void DoRender(WindowData* data) {
|
|||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
|
||||
if (data->renderTriangle) {
|
||||
utils::ComboRenderPassDescriptor desc({view});
|
||||
dawn::utils::ComboRenderPassDescriptor desc({view});
|
||||
// Use Load to check the swapchain is lazy cleared (we shouldn't see garbage from previous
|
||||
// frames).
|
||||
desc.cColorAttachments[0].loadOp = wgpu::LoadOp::Load;
|
||||
|
@ -151,7 +151,7 @@ void DoRender(WindowData* data) {
|
|||
data->clearCycle = 1.0f;
|
||||
}
|
||||
|
||||
utils::ComboRenderPassDescriptor desc({view});
|
||||
dawn::utils::ComboRenderPassDescriptor desc({view});
|
||||
desc.cColorAttachments[0].loadOp = wgpu::LoadOp::Clear;
|
||||
desc.cColorAttachments[0].clearValue = {data->clearCycle, 1.0f - data->clearCycle, 0.0f,
|
||||
1.0f};
|
||||
|
@ -314,8 +314,8 @@ int main(int argc, const char* argv[]) {
|
|||
queue = device.GetQueue();
|
||||
|
||||
// The hacky pipeline to render a triangle.
|
||||
utils::ComboRenderPipelineDescriptor pipelineDesc;
|
||||
pipelineDesc.vertex.module = utils::CreateShaderModule(device, R"(
|
||||
dawn::utils::ComboRenderPipelineDescriptor pipelineDesc;
|
||||
pipelineDesc.vertex.module = dawn::utils::CreateShaderModule(device, R"(
|
||||
@vertex fn main(@builtin(vertex_index) VertexIndex : u32)
|
||||
-> @builtin(position) vec4f {
|
||||
var pos = array(
|
||||
|
@ -325,7 +325,7 @@ int main(int argc, const char* argv[]) {
|
|||
);
|
||||
return vec4f(pos[VertexIndex], 0.0, 1.0);
|
||||
})");
|
||||
pipelineDesc.cFragment.module = utils::CreateShaderModule(device, R"(
|
||||
pipelineDesc.cFragment.module = dawn::utils::CreateShaderModule(device, R"(
|
||||
@fragment fn main() -> @location(0) vec4f {
|
||||
return vec4f(1.0, 0.0, 0.0, 1.0);
|
||||
})");
|
||||
|
@ -337,7 +337,7 @@ int main(int argc, const char* argv[]) {
|
|||
AddWindow();
|
||||
|
||||
while (windows.size() != 0) {
|
||||
utils::ScopedAutoreleasePool pool;
|
||||
dawn::utils::ScopedAutoreleasePool pool;
|
||||
glfwPollEvents();
|
||||
wgpuInstanceProcessEvents(instance->Get());
|
||||
|
||||
|
|
|
@ -102,15 +102,15 @@ static GLFWwindow* window = nullptr;
|
|||
|
||||
static dawn::wire::WireServer* wireServer = nullptr;
|
||||
static dawn::wire::WireClient* wireClient = nullptr;
|
||||
static utils::TerribleCommandBuffer* c2sBuf = nullptr;
|
||||
static utils::TerribleCommandBuffer* s2cBuf = nullptr;
|
||||
static dawn::utils::TerribleCommandBuffer* c2sBuf = nullptr;
|
||||
static dawn::utils::TerribleCommandBuffer* s2cBuf = nullptr;
|
||||
|
||||
static constexpr uint32_t kWidth = 640;
|
||||
static constexpr uint32_t kHeight = 480;
|
||||
|
||||
wgpu::Device CreateCppDawnDevice() {
|
||||
ScopedEnvironmentVar angleDefaultPlatform;
|
||||
if (GetEnvironmentVar("ANGLE_DEFAULT_PLATFORM").first.empty()) {
|
||||
dawn::ScopedEnvironmentVar angleDefaultPlatform;
|
||||
if (dawn::GetEnvironmentVar("ANGLE_DEFAULT_PLATFORM").first.empty()) {
|
||||
angleDefaultPlatform.Set("ANGLE_DEFAULT_PLATFORM", "swiftshader");
|
||||
}
|
||||
|
||||
|
@ -194,8 +194,8 @@ wgpu::Device CreateCppDawnDevice() {
|
|||
break;
|
||||
|
||||
case CmdBufType::Terrible: {
|
||||
c2sBuf = new utils::TerribleCommandBuffer();
|
||||
s2cBuf = new utils::TerribleCommandBuffer();
|
||||
c2sBuf = new dawn::utils::TerribleCommandBuffer();
|
||||
s2cBuf = new dawn::utils::TerribleCommandBuffer();
|
||||
|
||||
dawn::wire::WireServerDescriptor serverDesc = {};
|
||||
serverDesc.procs = &backendProcs;
|
||||
|
|
|
@ -171,8 +171,8 @@ DawnTestEnvironment::DawnTestEnvironment(int argc, char** argv) {
|
|||
ParseArgs(argc, argv);
|
||||
|
||||
if (mBackendValidationLevel != dawn::native::BackendValidationLevel::Disabled) {
|
||||
mPlatformDebugLogger =
|
||||
std::unique_ptr<utils::PlatformDebugLogger>(utils::CreatePlatformDebugLogger());
|
||||
mPlatformDebugLogger = std::unique_ptr<dawn::utils::PlatformDebugLogger>(
|
||||
dawn::utils::CreatePlatformDebugLogger());
|
||||
}
|
||||
|
||||
// Create a temporary instance to select available and preferred adapters. This is done before
|
||||
|
@ -397,7 +397,7 @@ std::unique_ptr<dawn::native::Instance> DawnTestEnvironment::CreateInstanceAndDi
|
|||
instance->EnableAdapterBlocklist(false);
|
||||
|
||||
#ifdef DAWN_ENABLE_BACKEND_OPENGLES
|
||||
if (GetEnvironmentVar("ANGLE_DEFAULT_PLATFORM").first.empty()) {
|
||||
if (dawn::GetEnvironmentVar("ANGLE_DEFAULT_PLATFORM").first.empty()) {
|
||||
const char* platform;
|
||||
if (!mANGLEBackend.empty()) {
|
||||
platform = mANGLEBackend.c_str();
|
||||
|
@ -408,7 +408,7 @@ std::unique_ptr<dawn::native::Instance> DawnTestEnvironment::CreateInstanceAndDi
|
|||
platform = "swiftshader";
|
||||
#endif
|
||||
}
|
||||
SetEnvironmentVar("ANGLE_DEFAULT_PLATFORM", platform);
|
||||
dawn::SetEnvironmentVar("ANGLE_DEFAULT_PLATFORM", platform);
|
||||
}
|
||||
#endif // DAWN_ENABLE_BACKEND_OPENGLES
|
||||
|
||||
|
@ -718,7 +718,8 @@ DawnTestBase::DawnTestBase(const AdapterTestParam& param) : mParam(param) {
|
|||
callback(WGPURequestDeviceStatus_Success, cDevice, nullptr, userdata);
|
||||
};
|
||||
|
||||
mWireHelper = utils::CreateWireHelper(procs, gTestEnv->UsesWire(), gTestEnv->GetWireTraceDir());
|
||||
mWireHelper =
|
||||
dawn::utils::CreateWireHelper(procs, gTestEnv->UsesWire(), gTestEnv->GetWireTraceDir());
|
||||
}
|
||||
|
||||
DawnTestBase::~DawnTestBase() {
|
||||
|
@ -770,35 +771,35 @@ bool DawnTestBase::IsVulkan() const {
|
|||
}
|
||||
|
||||
bool DawnTestBase::IsAMD() const {
|
||||
return gpu_info::IsAMD(mParam.adapterProperties.vendorID);
|
||||
return dawn::gpu_info::IsAMD(mParam.adapterProperties.vendorID);
|
||||
}
|
||||
|
||||
bool DawnTestBase::IsApple() const {
|
||||
return gpu_info::IsApple(mParam.adapterProperties.vendorID);
|
||||
return dawn::gpu_info::IsApple(mParam.adapterProperties.vendorID);
|
||||
}
|
||||
|
||||
bool DawnTestBase::IsARM() const {
|
||||
return gpu_info::IsARM(mParam.adapterProperties.vendorID);
|
||||
return dawn::gpu_info::IsARM(mParam.adapterProperties.vendorID);
|
||||
}
|
||||
|
||||
bool DawnTestBase::IsImgTec() const {
|
||||
return gpu_info::IsImgTec(mParam.adapterProperties.vendorID);
|
||||
return dawn::gpu_info::IsImgTec(mParam.adapterProperties.vendorID);
|
||||
}
|
||||
|
||||
bool DawnTestBase::IsIntel() const {
|
||||
return gpu_info::IsIntel(mParam.adapterProperties.vendorID);
|
||||
return dawn::gpu_info::IsIntel(mParam.adapterProperties.vendorID);
|
||||
}
|
||||
|
||||
bool DawnTestBase::IsNvidia() const {
|
||||
return gpu_info::IsNvidia(mParam.adapterProperties.vendorID);
|
||||
return dawn::gpu_info::IsNvidia(mParam.adapterProperties.vendorID);
|
||||
}
|
||||
|
||||
bool DawnTestBase::IsQualcomm() const {
|
||||
return gpu_info::IsQualcomm(mParam.adapterProperties.vendorID);
|
||||
return dawn::gpu_info::IsQualcomm(mParam.adapterProperties.vendorID);
|
||||
}
|
||||
|
||||
bool DawnTestBase::IsSwiftshader() const {
|
||||
return gpu_info::IsGoogleSwiftshader(mParam.adapterProperties.vendorID,
|
||||
return dawn::gpu_info::IsGoogleSwiftshader(mParam.adapterProperties.vendorID,
|
||||
mParam.adapterProperties.deviceID);
|
||||
}
|
||||
|
||||
|
@ -812,14 +813,14 @@ bool DawnTestBase::IsANGLESwiftShader() const {
|
|||
}
|
||||
|
||||
bool DawnTestBase::IsWARP() const {
|
||||
return gpu_info::IsMicrosoftWARP(mParam.adapterProperties.vendorID,
|
||||
return dawn::gpu_info::IsMicrosoftWARP(mParam.adapterProperties.vendorID,
|
||||
mParam.adapterProperties.deviceID);
|
||||
}
|
||||
|
||||
bool DawnTestBase::IsIntelGen12() const {
|
||||
return gpu_info::IsIntelGen12LP(mParam.adapterProperties.vendorID,
|
||||
return dawn::gpu_info::IsIntelGen12LP(mParam.adapterProperties.vendorID,
|
||||
mParam.adapterProperties.deviceID) ||
|
||||
gpu_info::IsIntelGen12HP(mParam.adapterProperties.vendorID,
|
||||
dawn::gpu_info::IsIntelGen12HP(mParam.adapterProperties.vendorID,
|
||||
mParam.adapterProperties.deviceID);
|
||||
}
|
||||
|
||||
|
@ -845,7 +846,7 @@ bool DawnTestBase::IsMacOS(int32_t majorVersion, int32_t minorVersion) const {
|
|||
return true;
|
||||
}
|
||||
int32_t majorVersionOut, minorVersionOut = 0;
|
||||
GetMacOSVersion(&majorVersionOut, &minorVersionOut);
|
||||
dawn::GetMacOSVersion(&majorVersionOut, &minorVersionOut);
|
||||
return (majorVersion != -1 && majorVersion == majorVersionOut) &&
|
||||
(minorVersion != -1 && minorVersion == minorVersionOut);
|
||||
#else
|
||||
|
@ -1146,7 +1147,7 @@ std::ostringstream& DawnTestBase::AddBufferExpectation(const char* file,
|
|||
uint64_t offset,
|
||||
uint64_t size,
|
||||
detail::Expectation* expectation) {
|
||||
uint64_t alignedSize = Align(size, uint64_t(4));
|
||||
uint64_t alignedSize = dawn::Align(size, uint64_t(4));
|
||||
auto readback = ReserveReadback(device, alignedSize);
|
||||
|
||||
// We need to enqueue the copy immediately because by the time we resolve the expectation,
|
||||
|
@ -1187,24 +1188,25 @@ std::ostringstream& DawnTestBase::AddTextureExpectationImpl(const char* file,
|
|||
ASSERT(targetDevice != nullptr);
|
||||
|
||||
if (bytesPerRow == 0) {
|
||||
bytesPerRow = Align(extent.width * dataSize, kTextureBytesPerRowAlignment);
|
||||
bytesPerRow = dawn::Align(extent.width * dataSize, kTextureBytesPerRowAlignment);
|
||||
} else {
|
||||
ASSERT(bytesPerRow >= extent.width * dataSize);
|
||||
ASSERT(bytesPerRow == Align(bytesPerRow, kTextureBytesPerRowAlignment));
|
||||
ASSERT(bytesPerRow == dawn::Align(bytesPerRow, kTextureBytesPerRowAlignment));
|
||||
}
|
||||
|
||||
uint32_t rowsPerImage = extent.height;
|
||||
uint32_t size = utils::RequiredBytesInCopy(bytesPerRow, rowsPerImage, extent.width,
|
||||
extent.height, extent.depthOrArrayLayers, dataSize);
|
||||
uint32_t size =
|
||||
dawn::utils::RequiredBytesInCopy(bytesPerRow, rowsPerImage, extent.width, extent.height,
|
||||
extent.depthOrArrayLayers, dataSize);
|
||||
|
||||
auto readback = ReserveReadback(targetDevice, Align(size, 4));
|
||||
auto readback = ReserveReadback(targetDevice, dawn::Align(size, 4));
|
||||
|
||||
// We need to enqueue the copy immediately because by the time we resolve the expectation,
|
||||
// the texture might have been modified.
|
||||
wgpu::ImageCopyTexture imageCopyTexture =
|
||||
utils::CreateImageCopyTexture(texture, level, origin, aspect);
|
||||
wgpu::ImageCopyBuffer imageCopyBuffer =
|
||||
utils::CreateImageCopyBuffer(readback.buffer, readback.offset, bytesPerRow, rowsPerImage);
|
||||
dawn::utils::CreateImageCopyTexture(texture, level, origin, aspect);
|
||||
wgpu::ImageCopyBuffer imageCopyBuffer = dawn::utils::CreateImageCopyBuffer(
|
||||
readback.buffer, readback.offset, bytesPerRow, rowsPerImage);
|
||||
|
||||
wgpu::CommandEncoder encoder = targetDevice.CreateCommandEncoder();
|
||||
encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, &extent);
|
||||
|
@ -1284,7 +1286,8 @@ std::ostringstream& DawnTestBase::ExpectSampledFloatDataImpl(wgpu::TextureView t
|
|||
}
|
||||
)";
|
||||
|
||||
wgpu::ShaderModule csModule = utils::CreateShaderModule(device, shaderSource.str().c_str());
|
||||
wgpu::ShaderModule csModule =
|
||||
dawn::utils::CreateShaderModule(device, shaderSource.str().c_str());
|
||||
|
||||
wgpu::ComputePipelineDescriptor pipelineDescriptor;
|
||||
pipelineDescriptor.compute.module = csModule;
|
||||
|
@ -1295,11 +1298,11 @@ std::ostringstream& DawnTestBase::ExpectSampledFloatDataImpl(wgpu::TextureView t
|
|||
// Create and initialize the slot buffer so that it won't unexpectedly affect the count of
|
||||
// resources lazily cleared.
|
||||
const std::vector<float> initialBufferData(width * height * componentCount * sampleCount, 0.f);
|
||||
wgpu::Buffer readbackBuffer = utils::CreateBufferFromData(
|
||||
wgpu::Buffer readbackBuffer = dawn::utils::CreateBufferFromData(
|
||||
device, initialBufferData.data(), sizeof(float) * initialBufferData.size(),
|
||||
wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::Storage);
|
||||
|
||||
wgpu::BindGroup bindGroup = utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0),
|
||||
wgpu::BindGroup bindGroup = dawn::utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0),
|
||||
{{0, textureView}, {1, readbackBuffer}});
|
||||
|
||||
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
|
||||
|
@ -1399,9 +1402,9 @@ std::ostringstream& DawnTestBase::ExpectAttachmentDepthStencilTestData(
|
|||
|
||||
// Upload the depth data.
|
||||
wgpu::ImageCopyTexture imageCopyTexture =
|
||||
utils::CreateImageCopyTexture(depthDataTexture, 0, {0, 0, 0});
|
||||
dawn::utils::CreateImageCopyTexture(depthDataTexture, 0, {0, 0, 0});
|
||||
wgpu::TextureDataLayout textureDataLayout =
|
||||
utils::CreateTextureDataLayout(0, sizeof(float) * width);
|
||||
dawn::utils::CreateTextureDataLayout(0, sizeof(float) * width);
|
||||
wgpu::Extent3D copyExtent = {width, height, 1};
|
||||
|
||||
queue.WriteTexture(&imageCopyTexture, expectedDepth.data(),
|
||||
|
@ -1409,9 +1412,9 @@ std::ostringstream& DawnTestBase::ExpectAttachmentDepthStencilTestData(
|
|||
}
|
||||
|
||||
// Pipeline for a full screen quad.
|
||||
utils::ComboRenderPipelineDescriptor pipelineDescriptor;
|
||||
dawn::utils::ComboRenderPipelineDescriptor pipelineDescriptor;
|
||||
|
||||
pipelineDescriptor.vertex.module = utils::CreateShaderModule(device, R"(
|
||||
pipelineDescriptor.vertex.module = dawn::utils::CreateShaderModule(device, R"(
|
||||
@vertex
|
||||
fn main(@builtin(vertex_index) VertexIndex : u32) -> @builtin(position) vec4f {
|
||||
var pos = array(
|
||||
|
@ -1424,7 +1427,7 @@ std::ostringstream& DawnTestBase::ExpectAttachmentDepthStencilTestData(
|
|||
if (depthDataTexture) {
|
||||
// Sample the input texture and write out depth. |result| will only be set to 1 if we
|
||||
// pass the depth test.
|
||||
pipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"(
|
||||
pipelineDescriptor.cFragment.module = dawn::utils::CreateShaderModule(device, R"(
|
||||
@group(0) @binding(0) var texture0 : texture_2d<f32>;
|
||||
|
||||
struct FragmentOut {
|
||||
|
@ -1440,7 +1443,7 @@ std::ostringstream& DawnTestBase::ExpectAttachmentDepthStencilTestData(
|
|||
return output;
|
||||
})");
|
||||
} else {
|
||||
pipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"(
|
||||
pipelineDescriptor.cFragment.module = dawn::utils::CreateShaderModule(device, R"(
|
||||
@fragment
|
||||
fn main() -> @location(0) u32 {
|
||||
return 1u;
|
||||
|
@ -1466,7 +1469,7 @@ std::ostringstream& DawnTestBase::ExpectAttachmentDepthStencilTestData(
|
|||
viewDesc.baseArrayLayer = arrayLayer;
|
||||
viewDesc.arrayLayerCount = 1;
|
||||
|
||||
utils::ComboRenderPassDescriptor passDescriptor({colorTexture.CreateView()},
|
||||
dawn::utils::ComboRenderPassDescriptor passDescriptor({colorTexture.CreateView()},
|
||||
texture.CreateView(&viewDesc));
|
||||
passDescriptor.cDepthStencilAttachmentInfo.depthLoadOp = wgpu::LoadOp::Load;
|
||||
passDescriptor.cDepthStencilAttachmentInfo.stencilLoadOp = wgpu::LoadOp::Load;
|
||||
|
@ -1494,7 +1497,7 @@ std::ostringstream& DawnTestBase::ExpectAttachmentDepthStencilTestData(
|
|||
pass.SetPipeline(pipeline);
|
||||
if (depthDataTexture) {
|
||||
// Bind the depth data texture.
|
||||
pass.SetBindGroup(0, utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0),
|
||||
pass.SetBindGroup(0, dawn::utils::MakeBindGroup(device, pipeline.GetBindGroupLayout(0),
|
||||
{{0, depthDataTexture.CreateView()}}));
|
||||
}
|
||||
pass.Draw(3);
|
||||
|
@ -1516,7 +1519,7 @@ void DawnTestBase::WaitABit(wgpu::Instance targetInstance) {
|
|||
}
|
||||
FlushWire();
|
||||
|
||||
utils::USleep(100);
|
||||
dawn::utils::USleep(100);
|
||||
}
|
||||
|
||||
void DawnTestBase::FlushWire() {
|
||||
|
@ -1553,7 +1556,7 @@ DawnTestBase::ReadbackReservation DawnTestBase::ReserveReadback(wgpu::Device tar
|
|||
// resource lazy clear in the tests.
|
||||
const std::vector<uint8_t> initialBufferData(readbackSize, 0u);
|
||||
slot.buffer =
|
||||
utils::CreateBufferFromData(targetDevice, initialBufferData.data(), readbackSize,
|
||||
dawn::utils::CreateBufferFromData(targetDevice, initialBufferData.data(), readbackSize,
|
||||
wgpu::BufferUsage::MapRead | wgpu::BufferUsage::CopyDst);
|
||||
|
||||
// This readback might be called from multiple threads
|
||||
|
@ -1675,19 +1678,19 @@ void DawnTestBase::ResolveDeferredExpectationsNow() {
|
|||
}
|
||||
}
|
||||
|
||||
bool utils::RGBA8::operator==(const utils::RGBA8& other) const {
|
||||
bool dawn::utils::RGBA8::operator==(const dawn::utils::RGBA8& other) const {
|
||||
return r == other.r && g == other.g && b == other.b && a == other.a;
|
||||
}
|
||||
|
||||
bool utils::RGBA8::operator!=(const utils::RGBA8& other) const {
|
||||
bool dawn::utils::RGBA8::operator!=(const dawn::utils::RGBA8& other) const {
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
bool utils::RGBA8::operator<=(const utils::RGBA8& other) const {
|
||||
bool dawn::utils::RGBA8::operator<=(const dawn::utils::RGBA8& other) const {
|
||||
return (r <= other.r && g <= other.g && b <= other.b && a <= other.a);
|
||||
}
|
||||
|
||||
bool utils::RGBA8::operator>=(const utils::RGBA8& other) const {
|
||||
bool dawn::utils::RGBA8::operator>=(const dawn::utils::RGBA8& other) const {
|
||||
return (r >= other.r && g >= other.g && b >= other.b && a >= other.a);
|
||||
}
|
||||
|
||||
|
@ -1724,12 +1727,12 @@ testing::AssertionResult CheckImpl(const T& expected, const U& actual, const T&
|
|||
}
|
||||
|
||||
template <>
|
||||
testing::AssertionResult CheckImpl<utils::RGBA8>(const utils::RGBA8& expected,
|
||||
const utils::RGBA8& actual,
|
||||
const utils::RGBA8& tolerance) {
|
||||
testing::AssertionResult CheckImpl<dawn::utils::RGBA8>(const dawn::utils::RGBA8& expected,
|
||||
const dawn::utils::RGBA8& actual,
|
||||
const dawn::utils::RGBA8& tolerance) {
|
||||
if (abs(expected.r - actual.r) > tolerance.r || abs(expected.g - actual.g) > tolerance.g ||
|
||||
abs(expected.b - actual.b) > tolerance.b || abs(expected.a - actual.a) > tolerance.a) {
|
||||
return tolerance == utils::RGBA8{}
|
||||
return tolerance == dawn::utils::RGBA8{}
|
||||
? testing::AssertionFailure() << expected << ", actual " << actual
|
||||
: testing::AssertionFailure()
|
||||
<< "within " << tolerance << " of " << expected << ", actual " << actual;
|
||||
|
@ -1767,7 +1770,7 @@ template <>
|
|||
testing::AssertionResult CheckImpl<float, uint16_t>(const float& expected,
|
||||
const uint16_t& actual,
|
||||
const float& tolerance) {
|
||||
float actualF32 = Float16ToFloat32(actual);
|
||||
float actualF32 = dawn::Float16ToFloat32(actual);
|
||||
if (abs(expected - actualF32) > tolerance) {
|
||||
return tolerance == 0.0
|
||||
? testing::AssertionFailure() << expected << ", actual " << actualF32
|
||||
|
@ -1835,7 +1838,7 @@ template class ExpectEq<uint8_t>;
|
|||
template class ExpectEq<uint16_t>;
|
||||
template class ExpectEq<uint32_t>;
|
||||
template class ExpectEq<uint64_t>;
|
||||
template class ExpectEq<utils::RGBA8>;
|
||||
template class ExpectEq<dawn::utils::RGBA8>;
|
||||
template class ExpectEq<float>;
|
||||
template class ExpectEq<float, uint16_t>;
|
||||
|
||||
|
@ -1892,5 +1895,5 @@ testing::AssertionResult ExpectBetweenColors<T>::Check(const void* data, size_t
|
|||
return testing::AssertionSuccess();
|
||||
}
|
||||
|
||||
template class ExpectBetweenColors<utils::RGBA8>;
|
||||
template class ExpectBetweenColors<dawn::utils::RGBA8>;
|
||||
} // namespace detail
|
||||
|
|
|
@ -127,11 +127,11 @@
|
|||
|
||||
struct GLFWwindow;
|
||||
|
||||
namespace utils {
|
||||
namespace dawn::utils {
|
||||
class PlatformDebugLogger;
|
||||
class TerribleCommandBuffer;
|
||||
class WireHelper;
|
||||
} // namespace utils
|
||||
} // namespace dawn::utils
|
||||
|
||||
namespace detail {
|
||||
class Expectation;
|
||||
|
@ -214,7 +214,7 @@ class DawnTestEnvironment : public testing::Environment {
|
|||
std::vector<wgpu::AdapterType> mDevicePreferences;
|
||||
std::vector<TestAdapterProperties> mAdapterProperties;
|
||||
|
||||
std::unique_ptr<utils::PlatformDebugLogger> mPlatformDebugLogger;
|
||||
std::unique_ptr<dawn::utils::PlatformDebugLogger> mPlatformDebugLogger;
|
||||
};
|
||||
|
||||
class DawnTestBase {
|
||||
|
@ -352,8 +352,9 @@ class DawnTestBase {
|
|||
uint32_t level = 0,
|
||||
wgpu::TextureAspect aspect = wgpu::TextureAspect::All,
|
||||
uint32_t bytesPerRow = 0) {
|
||||
uint32_t texelBlockSize = utils::GetTexelBlockSizeInBytes(format);
|
||||
uint32_t texelComponentCount = utils::GetWGSLRenderableColorTextureComponentCount(format);
|
||||
uint32_t texelBlockSize = dawn::utils::GetTexelBlockSizeInBytes(format);
|
||||
uint32_t texelComponentCount =
|
||||
dawn::utils::GetWGSLRenderableColorTextureComponentCount(format);
|
||||
|
||||
return AddTextureExpectationImpl(
|
||||
file, line, std::move(targetDevice),
|
||||
|
@ -583,9 +584,9 @@ class DawnTestBase {
|
|||
void* GetUniqueUserdata();
|
||||
|
||||
private:
|
||||
utils::ScopedAutoreleasePool mObjCAutoreleasePool;
|
||||
dawn::utils::ScopedAutoreleasePool mObjCAutoreleasePool;
|
||||
AdapterTestParam mParam;
|
||||
std::unique_ptr<utils::WireHelper> mWireHelper;
|
||||
std::unique_ptr<dawn::utils::WireHelper> mWireHelper;
|
||||
wgpu::Instance mInstance;
|
||||
wgpu::Adapter mAdapter;
|
||||
|
||||
|
@ -836,7 +837,7 @@ extern template class ExpectEq<uint8_t>;
|
|||
extern template class ExpectEq<int16_t>;
|
||||
extern template class ExpectEq<uint32_t>;
|
||||
extern template class ExpectEq<uint64_t>;
|
||||
extern template class ExpectEq<utils::RGBA8>;
|
||||
extern template class ExpectEq<dawn::utils::RGBA8>;
|
||||
extern template class ExpectEq<float>;
|
||||
extern template class ExpectEq<float, uint16_t>;
|
||||
|
||||
|
@ -858,7 +859,7 @@ class ExpectBetweenColors : public Expectation {
|
|||
// A color is considered between color0 and color1 when all channel values are within range of
|
||||
// each counterparts. It doesn't matter which value is higher or lower. Essentially color =
|
||||
// lerp(color0, color1, t) where t is [0,1]. But I don't want to be too strict here.
|
||||
extern template class ExpectBetweenColors<utils::RGBA8>;
|
||||
extern template class ExpectBetweenColors<dawn::utils::RGBA8>;
|
||||
|
||||
class CustomTextureExpectation : public Expectation {
|
||||
public:
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
using testing::_;
|
||||
|
@ -58,9 +59,9 @@ class AdapterDiscoveryTests : public ::testing::Test {};
|
|||
#if defined(DAWN_ENABLE_BACKEND_VULKAN)
|
||||
// Test only discovering the SwiftShader adapter
|
||||
TEST(AdapterDiscoveryTests, OnlySwiftShader) {
|
||||
dawn::native::Instance instance;
|
||||
native::Instance instance;
|
||||
|
||||
dawn::native::vulkan::AdapterDiscoveryOptions options;
|
||||
native::vulkan::AdapterDiscoveryOptions options;
|
||||
options.forceSwiftShader = true;
|
||||
instance.DiscoverAdapters(&options);
|
||||
|
||||
|
@ -78,9 +79,9 @@ TEST(AdapterDiscoveryTests, OnlySwiftShader) {
|
|||
|
||||
// Test discovering only Vulkan adapters
|
||||
TEST(AdapterDiscoveryTests, OnlyVulkan) {
|
||||
dawn::native::Instance instance;
|
||||
native::Instance instance;
|
||||
|
||||
dawn::native::vulkan::AdapterDiscoveryOptions options;
|
||||
native::vulkan::AdapterDiscoveryOptions options;
|
||||
instance.DiscoverAdapters(&options);
|
||||
|
||||
const auto& adapters = instance.GetAdapters();
|
||||
|
@ -96,9 +97,9 @@ TEST(AdapterDiscoveryTests, OnlyVulkan) {
|
|||
#if defined(DAWN_ENABLE_BACKEND_D3D11)
|
||||
// Test discovering only D3D11 adapters
|
||||
TEST(AdapterDiscoveryTests, OnlyD3D11) {
|
||||
dawn::native::Instance instance;
|
||||
native::Instance instance;
|
||||
|
||||
dawn::native::d3d11::AdapterDiscoveryOptions options;
|
||||
native::d3d11::AdapterDiscoveryOptions options;
|
||||
instance.DiscoverAdapters(&options);
|
||||
|
||||
const auto& adapters = instance.GetAdapters();
|
||||
|
@ -124,9 +125,9 @@ TEST(AdapterDiscoveryTests, MatchingDXGIAdapterD3D11) {
|
|||
break; // No more adapters to enumerate.
|
||||
}
|
||||
|
||||
dawn::native::Instance instance;
|
||||
native::Instance instance;
|
||||
|
||||
dawn::native::d3d11::AdapterDiscoveryOptions options;
|
||||
native::d3d11::AdapterDiscoveryOptions options;
|
||||
options.dxgiAdapter = std::move(dxgiAdapter);
|
||||
instance.DiscoverAdapters(&options);
|
||||
|
||||
|
@ -144,9 +145,9 @@ TEST(AdapterDiscoveryTests, MatchingDXGIAdapterD3D11) {
|
|||
#if defined(DAWN_ENABLE_BACKEND_D3D12)
|
||||
// Test discovering only D3D12 adapters
|
||||
TEST(AdapterDiscoveryTests, OnlyD3D12) {
|
||||
dawn::native::Instance instance;
|
||||
native::Instance instance;
|
||||
|
||||
dawn::native::d3d12::AdapterDiscoveryOptions options;
|
||||
native::d3d12::AdapterDiscoveryOptions options;
|
||||
instance.DiscoverAdapters(&options);
|
||||
|
||||
const auto& adapters = instance.GetAdapters();
|
||||
|
@ -172,9 +173,9 @@ TEST(AdapterDiscoveryTests, MatchingDXGIAdapterD3D12) {
|
|||
break; // No more adapters to enumerate.
|
||||
}
|
||||
|
||||
dawn::native::Instance instance;
|
||||
native::Instance instance;
|
||||
|
||||
dawn::native::d3d12::AdapterDiscoveryOptions options;
|
||||
native::d3d12::AdapterDiscoveryOptions options;
|
||||
options.dxgiAdapter = std::move(dxgiAdapter);
|
||||
instance.DiscoverAdapters(&options);
|
||||
|
||||
|
@ -192,9 +193,9 @@ TEST(AdapterDiscoveryTests, MatchingDXGIAdapterD3D12) {
|
|||
#if defined(DAWN_ENABLE_BACKEND_METAL)
|
||||
// Test discovering only Metal adapters
|
||||
TEST(AdapterDiscoveryTests, OnlyMetal) {
|
||||
dawn::native::Instance instance;
|
||||
native::Instance instance;
|
||||
|
||||
dawn::native::metal::AdapterDiscoveryOptions options;
|
||||
native::metal::AdapterDiscoveryOptions options;
|
||||
instance.DiscoverAdapters(&options);
|
||||
|
||||
const auto& adapters = instance.GetAdapters();
|
||||
|
@ -211,10 +212,10 @@ TEST(AdapterDiscoveryTests, OnlyMetal) {
|
|||
// Test discovering the Metal backend, then the Vulkan backend
|
||||
// does not duplicate adapters.
|
||||
TEST(AdapterDiscoveryTests, OneBackendThenTheOther) {
|
||||
dawn::native::Instance instance;
|
||||
native::Instance instance;
|
||||
uint32_t metalAdapterCount = 0;
|
||||
{
|
||||
dawn::native::metal::AdapterDiscoveryOptions options;
|
||||
native::metal::AdapterDiscoveryOptions options;
|
||||
instance.DiscoverAdapters(&options);
|
||||
|
||||
const auto& adapters = instance.GetAdapters();
|
||||
|
@ -227,7 +228,7 @@ TEST(AdapterDiscoveryTests, OneBackendThenTheOther) {
|
|||
}
|
||||
}
|
||||
{
|
||||
dawn::native::vulkan::AdapterDiscoveryOptions options;
|
||||
native::vulkan::AdapterDiscoveryOptions options;
|
||||
instance.DiscoverAdapters(&options);
|
||||
|
||||
uint32_t metalAdapterCount2 = 0;
|
||||
|
@ -445,3 +446,4 @@ TEST_F(AdapterCreationTest, GetInstance) {
|
|||
}
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
#include "dawn/utils/ComboRenderPipelineDescriptor.h"
|
||||
#include "dawn/utils/WGPUHelpers.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
constexpr static uint32_t kRTSize = 8;
|
||||
|
||||
class BindGroupTests : public DawnTest {
|
||||
|
@ -1330,8 +1333,8 @@ TEST_P(BindGroupTests, ArbitraryBindingNumbers) {
|
|||
// This is a regression test for crbug.com/dawn/355 which tests that destruction of a bind group
|
||||
// that holds the last reference to its bind group layout does not result in a use-after-free. In
|
||||
// the bug, the destructor of BindGroupBase, when destroying member mLayout,
|
||||
// Ref<BindGroupLayoutBase> assigns to Ref::mPointee, AFTER calling Release(). After the BGL is
|
||||
// destroyed, the storage for |mPointee| has been freed.
|
||||
// Ref<BindGroupLayoutBase> assigns to Ref::mPointee, AFTER calling Release(). After the BGL
|
||||
// is destroyed, the storage for |mPointee| has been freed.
|
||||
TEST_P(BindGroupTests, LastReferenceToBindGroupLayout) {
|
||||
wgpu::BufferDescriptor bufferDesc;
|
||||
bufferDesc.size = sizeof(float);
|
||||
|
@ -1513,3 +1516,6 @@ DAWN_INSTANTIATE_TEST(BindGroupTests,
|
|||
OpenGLBackend(),
|
||||
OpenGLESBackend(),
|
||||
VulkanBackend());
|
||||
|
||||
} // namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -20,20 +20,21 @@
|
|||
#include "dawn/utils/TestUtils.h"
|
||||
#include "dawn/utils/WGPUHelpers.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
#define EXPECT_LAZY_CLEAR(N, statement) \
|
||||
do { \
|
||||
if (UsesWire()) { \
|
||||
statement; \
|
||||
} else { \
|
||||
size_t lazyClearsBefore = dawn::native::GetLazyClearCountForTesting(device.Get()); \
|
||||
size_t lazyClearsBefore = native::GetLazyClearCountForTesting(device.Get()); \
|
||||
statement; \
|
||||
size_t lazyClearsAfter = dawn::native::GetLazyClearCountForTesting(device.Get()); \
|
||||
size_t lazyClearsAfter = native::GetLazyClearCountForTesting(device.Get()); \
|
||||
EXPECT_EQ(N, lazyClearsAfter - lazyClearsBefore); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
namespace {
|
||||
|
||||
struct BufferZeroInitInCopyT2BSpec {
|
||||
wgpu::Extent3D textureSize;
|
||||
uint64_t bufferOffset;
|
||||
|
@ -43,8 +44,6 @@ struct BufferZeroInitInCopyT2BSpec {
|
|||
uint32_t lazyClearCount;
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
class BufferZeroInitTest : public DawnTest {
|
||||
protected:
|
||||
std::vector<wgpu::FeatureName> GetRequiredFeatures() override {
|
||||
|
@ -1388,3 +1387,6 @@ DAWN_INSTANTIATE_TEST(BufferZeroInitTest,
|
|||
OpenGLBackend({"nonzero_clear_resources_on_creation_for_testing"}),
|
||||
OpenGLESBackend({"nonzero_clear_resources_on_creation_for_testing"}),
|
||||
VulkanBackend({"nonzero_clear_resources_on_creation_for_testing"}));
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
#include "dawn/utils/ComboRenderPipelineDescriptor.h"
|
||||
#include "dawn/utils/WGPUHelpers.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
class ClipSpaceTest : public DawnTest {
|
||||
protected:
|
||||
wgpu::RenderPipeline CreatePipelineForTest() {
|
||||
|
@ -99,3 +102,6 @@ DAWN_INSTANTIATE_TEST(ClipSpaceTest,
|
|||
OpenGLBackend(),
|
||||
OpenGLESBackend(),
|
||||
VulkanBackend());
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
#include "dawn/utils/ComboRenderPipelineDescriptor.h"
|
||||
#include "dawn/utils/WGPUHelpers.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
constexpr static unsigned int kRTSize = 64;
|
||||
|
||||
class ColorStateTest : public DawnTest {
|
||||
|
@ -1195,3 +1198,6 @@ DAWN_INSTANTIATE_TEST(ColorStateTest,
|
|||
OpenGLBackend(),
|
||||
OpenGLESBackend(),
|
||||
VulkanBackend());
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
#include "dawn/tests/DawnTest.h"
|
||||
#include "dawn/utils/WGPUHelpers.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
class CommandEncoderTests : public DawnTest {};
|
||||
|
||||
// Tests WriteBuffer commands on CommandEncoder.
|
||||
|
@ -52,3 +55,6 @@ DAWN_INSTANTIATE_TEST(CommandEncoderTests,
|
|||
OpenGLBackend(),
|
||||
OpenGLESBackend(),
|
||||
VulkanBackend());
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -23,6 +23,9 @@
|
|||
#include "dawn/utils/TextureUtils.h"
|
||||
#include "dawn/utils/WGPUHelpers.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
// The helper struct to configure the copies between buffers and textures.
|
||||
struct CopyConfig {
|
||||
wgpu::TextureDescriptor textureDescriptor;
|
||||
|
@ -34,10 +37,8 @@ struct CopyConfig {
|
|||
uint32_t rowsPerImage = wgpu::kCopyStrideUndefined;
|
||||
};
|
||||
|
||||
namespace {
|
||||
using TextureFormat = wgpu::TextureFormat;
|
||||
DAWN_TEST_PARAM_STRUCT(CompressedTextureFormatTestParams, TextureFormat);
|
||||
} // namespace
|
||||
|
||||
class CompressedTextureFormatTest : public DawnTestWithParams<CompressedTextureFormatTestParams> {
|
||||
protected:
|
||||
|
@ -1324,3 +1325,6 @@ DAWN_INSTANTIATE_TEST_P(CompressedTextureWriteTextureTest,
|
|||
OpenGLESBackend(), VulkanBackend()},
|
||||
std::vector<wgpu::TextureFormat>(utils::kCompressedFormats.begin(),
|
||||
utils::kCompressedFormats.end()));
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
|
||||
#include "dawn/utils/WGPUHelpers.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
class ComputeCopyStorageBufferTests : public DawnTest {
|
||||
public:
|
||||
static constexpr int kInstances = 4;
|
||||
|
@ -151,3 +154,6 @@ DAWN_INSTANTIATE_TEST(ComputeCopyStorageBufferTests,
|
|||
OpenGLBackend(),
|
||||
OpenGLESBackend(),
|
||||
VulkanBackend());
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
#include "dawn/tests/DawnTest.h"
|
||||
#include "dawn/utils/WGPUHelpers.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
constexpr static std::initializer_list<uint32_t> kSentinelData{0, 0, 0};
|
||||
|
||||
class ComputeDispatchTests : public DawnTest {
|
||||
|
@ -319,3 +322,6 @@ DAWN_INSTANTIATE_TEST(ComputeDispatchTests,
|
|||
OpenGLBackend(),
|
||||
OpenGLESBackend(),
|
||||
VulkanBackend());
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
|
||||
#include "dawn/utils/WGPUHelpers.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
// Tests flow control in WGSL shaders. This helps to identify bugs either in Tint's WGSL
|
||||
// compilation, or driver shader compilation.
|
||||
class ComputeFlowControlTests : public DawnTest {
|
||||
|
@ -506,3 +509,6 @@ DAWN_INSTANTIATE_TEST(ComputeFlowControlTests,
|
|||
OpenGLBackend(),
|
||||
OpenGLESBackend(),
|
||||
VulkanBackend());
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "dawn/tests/DawnTest.h"
|
||||
#include "dawn/utils/WGPUHelpers.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
// Helper for replacing all occurrences of substr in str with replacement
|
||||
|
@ -594,9 +595,9 @@ fn main() {
|
|||
})";
|
||||
|
||||
// https://www.w3.org/TR/WGSL/#alignment-and-size
|
||||
// Structure size: roundUp(AlignOf(S), OffsetOf(S, L) + SizeOf(S, L))
|
||||
// Structure size: RoundUp(AlignOf(S), OffsetOf(S, L) + SizeOf(S, L))
|
||||
// https://www.w3.org/TR/WGSL/#storage-class-constraints
|
||||
// RequiredAlignOf(S, uniform): roundUp(16, max(AlignOf(T0), ..., AlignOf(TN)))
|
||||
// RequiredAlignOf(S, uniform): RoundUp(16, max(AlignOf(T0), ..., AlignOf(TN)))
|
||||
uint32_t dataAlign = isUniform ? std::max(size_t(16u), field.GetAlign()) : field.GetAlign();
|
||||
|
||||
// https://www.w3.org/TR/WGSL/#structure-layout-rules
|
||||
|
@ -1152,4 +1153,5 @@ INSTANTIATE_TEST_SUITE_P(,
|
|||
DawnTestBase::PrintToStringParamName("ComputeLayoutMemoryBufferTests"));
|
||||
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(ComputeLayoutMemoryBufferTests);
|
||||
|
||||
} // namespace
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
|
||||
#include "dawn/utils/WGPUHelpers.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
class ComputeSharedMemoryTests : public DawnTest {
|
||||
public:
|
||||
static constexpr uint32_t kInstances = 11;
|
||||
|
@ -204,3 +207,6 @@ DAWN_INSTANTIATE_TEST(ComputeSharedMemoryTests,
|
|||
OpenGLESBackend(),
|
||||
VulkanBackend(),
|
||||
VulkanBackend({}, {"use_vulkan_zero_initialize_workgroup_memory_extension"}));
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
#include "dawn/tests/DawnTest.h"
|
||||
#include "dawn/utils/WGPUHelpers.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
class ComputeStorageBufferBarrierTests : public DawnTest {
|
||||
protected:
|
||||
static constexpr uint32_t kNumValues = 100;
|
||||
|
@ -415,3 +418,6 @@ DAWN_INSTANTIATE_TEST(ComputeStorageBufferBarrierTests,
|
|||
OpenGLBackend(),
|
||||
OpenGLESBackend(),
|
||||
VulkanBackend());
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "dawn/utils/ComboRenderPipelineDescriptor.h"
|
||||
#include "dawn/utils/WGPUHelpers.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
wgpu::Texture Create2DTexture(wgpu::Device device,
|
||||
|
@ -275,7 +276,6 @@ class CopyExternalTextureForBrowserTests_Basic
|
|||
EXPECT_TEXTURE_EQ(expected.data(), dstTexture, dstOrigin, copySize);
|
||||
}
|
||||
};
|
||||
} // anonymous namespace
|
||||
|
||||
TEST_P(CopyExternalTextureForBrowserTests_Basic, Copy) {
|
||||
DAWN_SUPPRESS_TEST_IF(IsOpenGLES());
|
||||
|
@ -386,3 +386,6 @@ DAWN_INSTANTIATE_TEST_P(
|
|||
CopyRect::BottomRight, CopyRect::FullSize}),
|
||||
std::vector<ScaleType>({ScaleType::UpScale, ScaleType::DownScale, ScaleType::NoScale}),
|
||||
std::vector<FlipY>({false, true}));
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -23,6 +23,9 @@
|
|||
#include "dawn/utils/TextureUtils.h"
|
||||
#include "dawn/utils/WGPUHelpers.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
// For MinimumBufferSpec bytesPerRow and rowsPerImage, compute a default from the copy extent.
|
||||
constexpr uint32_t kStrideComputeDefault = 0xFFFF'FFFEul;
|
||||
|
||||
|
@ -2922,3 +2925,6 @@ DAWN_INSTANTIATE_TEST(T2TCopyFromDirtyHeapTests,
|
|||
OpenGLBackend(),
|
||||
OpenGLESBackend(),
|
||||
VulkanBackend());
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -22,7 +22,9 @@
|
|||
#include "dawn/utils/TextureUtils.h"
|
||||
#include "dawn/utils/WGPUHelpers.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
static constexpr wgpu::TextureFormat kTextureFormat = wgpu::TextureFormat::RGBA8Unorm;
|
||||
|
||||
// Set default texture size to single line texture for color conversion tests.
|
||||
|
@ -148,7 +150,6 @@ static constexpr std::array<ColorSpaceInfo, kSupportedColorSpaceCount> ColorSpac
|
|||
}
|
||||
//
|
||||
}};
|
||||
} // anonymous namespace
|
||||
|
||||
template <typename Parent>
|
||||
class CopyTextureForBrowserTests : public Parent {
|
||||
|
@ -1225,3 +1226,6 @@ DAWN_INSTANTIATE_TEST_P(CopyTextureForBrowser_ColorSpace,
|
|||
wgpu::AlphaMode::Unpremultiplied}),
|
||||
std::vector<wgpu::AlphaMode>({wgpu::AlphaMode::Premultiplied,
|
||||
wgpu::AlphaMode::Unpremultiplied}));
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -18,14 +18,15 @@
|
|||
#include "dawn/utils/ComboRenderPipelineDescriptor.h"
|
||||
#include "dawn/utils/WGPUHelpers.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
struct CreatePipelineAsyncTask {
|
||||
wgpu::ComputePipeline computePipeline = nullptr;
|
||||
wgpu::RenderPipeline renderPipeline = nullptr;
|
||||
bool isCompleted = false;
|
||||
std::string message;
|
||||
};
|
||||
} // anonymous namespace
|
||||
|
||||
class CreatePipelineAsyncTest : public DawnTest {
|
||||
protected:
|
||||
|
@ -961,3 +962,6 @@ DAWN_INSTANTIATE_TEST(CreatePipelineAsyncTest,
|
|||
OpenGLBackend(),
|
||||
OpenGLESBackend(),
|
||||
VulkanBackend());
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
#include "dawn/utils/ComboRenderPipelineDescriptor.h"
|
||||
#include "dawn/utils/WGPUHelpers.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
class CullingTest : public DawnTest {
|
||||
protected:
|
||||
wgpu::RenderPipeline CreatePipelineForTest(wgpu::FrontFace frontFace, wgpu::CullMode cullMode) {
|
||||
|
@ -133,3 +136,6 @@ DAWN_INSTANTIATE_TEST(CullingTest,
|
|||
OpenGLBackend(),
|
||||
OpenGLESBackend(),
|
||||
VulkanBackend());
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -21,9 +21,10 @@
|
|||
#include "dawn/utils/ComboRenderPipelineDescriptor.h"
|
||||
#include "dawn/utils/WGPUHelpers.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
using ::testing::NiceMock;
|
||||
} // namespace
|
||||
|
||||
class D3D12CachingTests : public DawnTest {
|
||||
protected:
|
||||
|
@ -33,7 +34,7 @@ class D3D12CachingTests : public DawnTest {
|
|||
DAWN_SKIP_TEST_IF_BASE(true, "suppressed", "TODO(dawn:1341)");
|
||||
}
|
||||
|
||||
std::unique_ptr<dawn::platform::Platform> CreateTestPlatform() override {
|
||||
std::unique_ptr<platform::Platform> CreateTestPlatform() override {
|
||||
return std::make_unique<DawnCachingMockPlatform>(&mMockCache);
|
||||
}
|
||||
|
||||
|
@ -181,3 +182,6 @@ TEST_P(D3D12CachingTests, ReuseShaderWithMultipleEntryPoints) {
|
|||
}
|
||||
|
||||
DAWN_INSTANTIATE_TEST(D3D12CachingTests, D3D12Backend());
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
using Microsoft::WRL::ComPtr;
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
class D3DResourceTestBase : public DawnTest {
|
||||
|
@ -48,8 +49,7 @@ class D3DResourceTestBase : public DawnTest {
|
|||
}
|
||||
|
||||
// Create the D3D11 device/contexts that will be used in subsequent tests
|
||||
ComPtr<IDXGIAdapter> dxgiAdapter =
|
||||
dawn::native::d3d::GetDXGIAdapter(device.GetAdapter().Get());
|
||||
ComPtr<IDXGIAdapter> dxgiAdapter = native::d3d::GetDXGIAdapter(device.GetAdapter().Get());
|
||||
DXGI_ADAPTER_DESC adapterDesc;
|
||||
|
||||
HRESULT hr = dxgiAdapter->GetDesc(&adapterDesc);
|
||||
|
@ -98,7 +98,7 @@ class D3DResourceTestBase : public DawnTest {
|
|||
}
|
||||
|
||||
protected:
|
||||
std::unique_ptr<dawn::native::d3d::ExternalImageDXGI> CreateExternalImage(
|
||||
std::unique_ptr<native::d3d::ExternalImageDXGI> CreateExternalImage(
|
||||
WGPUDevice targetDevice,
|
||||
ID3D11Texture2D* d3d11Texture,
|
||||
const wgpu::TextureDescriptor* dawnDesc) const {
|
||||
|
@ -111,13 +111,13 @@ class D3DResourceTestBase : public DawnTest {
|
|||
&textureSharedHandle),
|
||||
S_OK);
|
||||
|
||||
dawn::native::d3d::ExternalImageDescriptorDXGISharedHandle externalImageDesc;
|
||||
native::d3d::ExternalImageDescriptorDXGISharedHandle externalImageDesc;
|
||||
externalImageDesc.cTextureDescriptor =
|
||||
reinterpret_cast<const WGPUTextureDescriptor*>(dawnDesc);
|
||||
externalImageDesc.sharedHandle = textureSharedHandle;
|
||||
|
||||
std::unique_ptr<dawn::native::d3d::ExternalImageDXGI> externalImage =
|
||||
dawn::native::d3d::ExternalImageDXGI::Create(targetDevice, &externalImageDesc);
|
||||
std::unique_ptr<native::d3d::ExternalImageDXGI> externalImage =
|
||||
native::d3d::ExternalImageDXGI::Create(targetDevice, &externalImageDesc);
|
||||
|
||||
// Now that we've created all of our resources, we can close the handle
|
||||
// since we no longer need it.
|
||||
|
@ -126,17 +126,16 @@ class D3DResourceTestBase : public DawnTest {
|
|||
return externalImage;
|
||||
}
|
||||
|
||||
void WrapSharedHandle(
|
||||
const wgpu::TextureDescriptor* dawnDesc,
|
||||
void WrapSharedHandle(const wgpu::TextureDescriptor* dawnDesc,
|
||||
const D3D11_TEXTURE2D_DESC* baseD3dDescriptor,
|
||||
wgpu::Texture* dawnTexture,
|
||||
ID3D11Texture2D** d3d11TextureOut,
|
||||
std::unique_ptr<dawn::native::d3d::ExternalImageDXGI>* externalImageOut) const {
|
||||
std::unique_ptr<native::d3d::ExternalImageDXGI>* externalImageOut) const {
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
HRESULT hr = mD3d11Device->CreateTexture2D(baseD3dDescriptor, nullptr, &d3d11Texture);
|
||||
ASSERT_EQ(hr, S_OK);
|
||||
|
||||
std::unique_ptr<dawn::native::d3d::ExternalImageDXGI> externalImage =
|
||||
std::unique_ptr<native::d3d::ExternalImageDXGI> externalImage =
|
||||
CreateExternalImage(device.Get(), d3d11Texture.Get(), dawnDesc);
|
||||
|
||||
// Cannot access a non-existent external image (ex. validation error).
|
||||
|
@ -144,7 +143,7 @@ class D3DResourceTestBase : public DawnTest {
|
|||
return;
|
||||
}
|
||||
|
||||
dawn::native::d3d::ExternalImageDXGIBeginAccessDescriptor externalAccessDesc;
|
||||
native::d3d::ExternalImageDXGIBeginAccessDescriptor externalAccessDesc;
|
||||
externalAccessDesc.usage = static_cast<WGPUTextureUsageFlags>(dawnDesc->usage);
|
||||
|
||||
*dawnTexture = wgpu::Texture::Acquire(externalImage->BeginAccess(&externalAccessDesc));
|
||||
|
@ -165,8 +164,6 @@ class D3DResourceTestBase : public DawnTest {
|
|||
wgpu::TextureDescriptor baseDawnDescriptor;
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
// A small fixture used to initialize default data for the D3DResource validation tests.
|
||||
// These tests are skipped if the harness is using the wire.
|
||||
class D3DSharedHandleValidation : public D3DResourceTestBase {};
|
||||
|
@ -177,13 +174,13 @@ TEST_P(D3DSharedHandleValidation, Success) {
|
|||
|
||||
wgpu::Texture texture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
std::unique_ptr<dawn::native::d3d::ExternalImageDXGI> externalImage;
|
||||
std::unique_ptr<native::d3d::ExternalImageDXGI> externalImage;
|
||||
WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture,
|
||||
&externalImage);
|
||||
|
||||
ASSERT_NE(texture.Get(), nullptr);
|
||||
|
||||
dawn::native::d3d::ExternalImageDXGIFenceDescriptor signalFence;
|
||||
native::d3d::ExternalImageDXGIFenceDescriptor signalFence;
|
||||
externalImage->EndAccess(texture.Get(), &signalFence);
|
||||
texture.Destroy();
|
||||
}
|
||||
|
@ -199,13 +196,13 @@ TEST_P(D3DSharedHandleValidation, SuccessWithInternalUsageDescriptor) {
|
|||
|
||||
wgpu::Texture texture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
std::unique_ptr<dawn::native::d3d::ExternalImageDXGI> externalImage;
|
||||
std::unique_ptr<native::d3d::ExternalImageDXGI> externalImage;
|
||||
WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture,
|
||||
&externalImage);
|
||||
|
||||
ASSERT_NE(texture.Get(), nullptr);
|
||||
|
||||
dawn::native::d3d::ExternalImageDXGIFenceDescriptor signalFence;
|
||||
native::d3d::ExternalImageDXGIFenceDescriptor signalFence;
|
||||
externalImage->EndAccess(texture.Get(), &signalFence);
|
||||
texture.Destroy();
|
||||
}
|
||||
|
@ -220,7 +217,7 @@ TEST_P(D3DSharedHandleValidation, InvalidTextureDescriptor) {
|
|||
|
||||
wgpu::Texture texture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
std::unique_ptr<dawn::native::d3d::ExternalImageDXGI> externalImage;
|
||||
std::unique_ptr<native::d3d::ExternalImageDXGI> externalImage;
|
||||
ASSERT_DEVICE_ERROR(WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture,
|
||||
&d3d11Texture, &externalImage));
|
||||
|
||||
|
@ -234,7 +231,7 @@ TEST_P(D3DSharedHandleValidation, InvalidMipLevelCount) {
|
|||
|
||||
wgpu::Texture texture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
std::unique_ptr<dawn::native::d3d::ExternalImageDXGI> externalImage;
|
||||
std::unique_ptr<native::d3d::ExternalImageDXGI> externalImage;
|
||||
ASSERT_DEVICE_ERROR(WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture,
|
||||
&d3d11Texture, &externalImage));
|
||||
|
||||
|
@ -248,7 +245,7 @@ TEST_P(D3DSharedHandleValidation, InvalidDepth) {
|
|||
|
||||
wgpu::Texture texture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
std::unique_ptr<dawn::native::d3d::ExternalImageDXGI> externalImage;
|
||||
std::unique_ptr<native::d3d::ExternalImageDXGI> externalImage;
|
||||
ASSERT_DEVICE_ERROR(WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture,
|
||||
&d3d11Texture, &externalImage));
|
||||
|
||||
|
@ -262,7 +259,7 @@ TEST_P(D3DSharedHandleValidation, InvalidSampleCount) {
|
|||
|
||||
wgpu::Texture texture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
std::unique_ptr<dawn::native::d3d::ExternalImageDXGI> externalImage;
|
||||
std::unique_ptr<native::d3d::ExternalImageDXGI> externalImage;
|
||||
ASSERT_DEVICE_ERROR(WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture,
|
||||
&d3d11Texture, &externalImage));
|
||||
|
||||
|
@ -276,7 +273,7 @@ TEST_P(D3DSharedHandleValidation, InvalidWidth) {
|
|||
|
||||
wgpu::Texture texture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
std::unique_ptr<dawn::native::d3d::ExternalImageDXGI> externalImage;
|
||||
std::unique_ptr<native::d3d::ExternalImageDXGI> externalImage;
|
||||
ASSERT_DEVICE_ERROR(WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture,
|
||||
&d3d11Texture, &externalImage));
|
||||
|
||||
|
@ -290,7 +287,7 @@ TEST_P(D3DSharedHandleValidation, InvalidHeight) {
|
|||
|
||||
wgpu::Texture texture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
std::unique_ptr<dawn::native::d3d::ExternalImageDXGI> externalImage;
|
||||
std::unique_ptr<native::d3d::ExternalImageDXGI> externalImage;
|
||||
ASSERT_DEVICE_ERROR(WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture,
|
||||
&d3d11Texture, &externalImage));
|
||||
|
||||
|
@ -304,7 +301,7 @@ TEST_P(D3DSharedHandleValidation, InvalidFormat) {
|
|||
|
||||
wgpu::Texture texture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
std::unique_ptr<dawn::native::d3d::ExternalImageDXGI> externalImage;
|
||||
std::unique_ptr<native::d3d::ExternalImageDXGI> externalImage;
|
||||
ASSERT_DEVICE_ERROR(WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture,
|
||||
&d3d11Texture, &externalImage));
|
||||
|
||||
|
@ -318,7 +315,7 @@ TEST_P(D3DSharedHandleValidation, InvalidNumD3DMipLevels) {
|
|||
|
||||
wgpu::Texture texture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
std::unique_ptr<dawn::native::d3d::ExternalImageDXGI> externalImage;
|
||||
std::unique_ptr<native::d3d::ExternalImageDXGI> externalImage;
|
||||
ASSERT_DEVICE_ERROR(WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture,
|
||||
&d3d11Texture, &externalImage));
|
||||
|
||||
|
@ -332,7 +329,7 @@ TEST_P(D3DSharedHandleValidation, InvalidD3DArraySize) {
|
|||
|
||||
wgpu::Texture texture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
std::unique_ptr<dawn::native::d3d::ExternalImageDXGI> externalImage;
|
||||
std::unique_ptr<native::d3d::ExternalImageDXGI> externalImage;
|
||||
ASSERT_DEVICE_ERROR(WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture,
|
||||
&d3d11Texture, &externalImage));
|
||||
|
||||
|
@ -438,23 +435,22 @@ class D3DSharedHandleUsageTests : public D3DResourceTestBase {
|
|||
d3d11DeviceContext4->Signal(d3d11Fence, fenceSignalValue);
|
||||
}
|
||||
|
||||
void WaitAndWrapD3D11Texture(
|
||||
const wgpu::TextureDescriptor& dawnDescriptor,
|
||||
void WaitAndWrapD3D11Texture(const wgpu::TextureDescriptor& dawnDescriptor,
|
||||
HANDLE sharedHandle,
|
||||
HANDLE fenceSharedHandle,
|
||||
uint64_t fenceWaitValue,
|
||||
wgpu::Texture* dawnTextureOut,
|
||||
std::unique_ptr<dawn::native::d3d::ExternalImageDXGI>* externalImageOut,
|
||||
std::unique_ptr<native::d3d::ExternalImageDXGI>* externalImageOut,
|
||||
bool isInitialized) const {
|
||||
dawn::native::d3d::ExternalImageDescriptorDXGISharedHandle externalImageDesc = {};
|
||||
native::d3d::ExternalImageDescriptorDXGISharedHandle externalImageDesc = {};
|
||||
externalImageDesc.sharedHandle = sharedHandle;
|
||||
externalImageDesc.cTextureDescriptor =
|
||||
reinterpret_cast<const WGPUTextureDescriptor*>(&dawnDescriptor);
|
||||
|
||||
std::unique_ptr<dawn::native::d3d::ExternalImageDXGI> externalImage =
|
||||
dawn::native::d3d::ExternalImageDXGI::Create(device.Get(), &externalImageDesc);
|
||||
std::unique_ptr<native::d3d::ExternalImageDXGI> externalImage =
|
||||
native::d3d::ExternalImageDXGI::Create(device.Get(), &externalImageDesc);
|
||||
|
||||
dawn::native::d3d::ExternalImageDXGIBeginAccessDescriptor externalAccessDesc;
|
||||
native::d3d::ExternalImageDXGIBeginAccessDescriptor externalAccessDesc;
|
||||
externalAccessDesc.isInitialized = isInitialized;
|
||||
externalAccessDesc.usage = static_cast<WGPUTextureUsageFlags>(dawnDescriptor.usage);
|
||||
if (fenceSharedHandle != nullptr) {
|
||||
|
@ -465,13 +461,12 @@ class D3DSharedHandleUsageTests : public D3DResourceTestBase {
|
|||
*externalImageOut = std::move(externalImage);
|
||||
}
|
||||
|
||||
void WrapAndClearD3D11Texture(
|
||||
const wgpu::TextureDescriptor& dawnDescriptor,
|
||||
void WrapAndClearD3D11Texture(const wgpu::TextureDescriptor& dawnDescriptor,
|
||||
const D3D11_TEXTURE2D_DESC& d3dDescriptor,
|
||||
const wgpu::Color& clearColor,
|
||||
wgpu::Texture* dawnTextureOut,
|
||||
ID3D11Texture2D** d3d11TextureOut,
|
||||
std::unique_ptr<dawn::native::d3d::ExternalImageDXGI>* externalImageOut,
|
||||
std::unique_ptr<native::d3d::ExternalImageDXGI>* externalImageOut,
|
||||
bool isInitialized = true) const {
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
ComPtr<ID3D11Fence> d3d11Fence;
|
||||
|
@ -496,7 +491,7 @@ class D3DSharedHandleUsageTests : public D3DResourceTestBase {
|
|||
|
||||
void ExpectPixelRGBA8EQ(ID3D11Texture2D* d3d11Texture,
|
||||
const wgpu::Color& color,
|
||||
const dawn::native::d3d::ExternalImageDXGIFenceDescriptor* waitFence) {
|
||||
const native::d3d::ExternalImageDXGIFenceDescriptor* waitFence) {
|
||||
D3D11_TEXTURE2D_DESC texture2DDesc;
|
||||
d3d11Texture->GetDesc(&texture2DDesc);
|
||||
|
||||
|
@ -573,7 +568,7 @@ TEST_P(D3DSharedHandleUsageTests, ClearInD3D11CopyAndReadbackInD3D) {
|
|||
const wgpu::Color clearColor{1.0f, 1.0f, 0.0f, 1.0f};
|
||||
wgpu::Texture dawnSrcTexture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
std::unique_ptr<dawn::native::d3d::ExternalImageDXGI> externalImage;
|
||||
std::unique_ptr<native::d3d::ExternalImageDXGI> externalImage;
|
||||
WrapAndClearD3D11Texture(baseDawnDescriptor, baseD3dDescriptor, clearColor, &dawnSrcTexture,
|
||||
&d3d11Texture, &externalImage);
|
||||
ASSERT_NE(dawnSrcTexture.Get(), nullptr);
|
||||
|
@ -582,7 +577,7 @@ TEST_P(D3DSharedHandleUsageTests, ClearInD3D11CopyAndReadbackInD3D) {
|
|||
wgpu::Texture dawnCopyDestTexture = device.CreateTexture(&baseDawnDescriptor);
|
||||
SimpleCopyTextureToTexture(dawnSrcTexture, dawnCopyDestTexture);
|
||||
|
||||
dawn::native::d3d::ExternalImageDXGIFenceDescriptor signalFence;
|
||||
native::d3d::ExternalImageDXGIFenceDescriptor signalFence;
|
||||
externalImage->EndAccess(dawnSrcTexture.Get(), &signalFence);
|
||||
dawnSrcTexture.Destroy();
|
||||
|
||||
|
@ -601,7 +596,7 @@ TEST_P(D3DSharedHandleUsageTests, ClearInD3D11ReadbackInD3D) {
|
|||
const wgpu::Color clearColor{1.0f, 1.0f, 0.0f, 1.0f};
|
||||
wgpu::Texture dawnTexture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
std::unique_ptr<dawn::native::d3d::ExternalImageDXGI> externalImage;
|
||||
std::unique_ptr<native::d3d::ExternalImageDXGI> externalImage;
|
||||
WrapAndClearD3D11Texture(baseDawnDescriptor, baseD3dDescriptor, clearColor, &dawnTexture,
|
||||
&d3d11Texture, &externalImage);
|
||||
ASSERT_NE(dawnTexture.Get(), nullptr);
|
||||
|
@ -612,7 +607,7 @@ TEST_P(D3DSharedHandleUsageTests, ClearInD3D11ReadbackInD3D) {
|
|||
clearColor.a * 255),
|
||||
dawnTexture, 0, 0);
|
||||
|
||||
dawn::native::d3d::ExternalImageDXGIFenceDescriptor signalFence;
|
||||
native::d3d::ExternalImageDXGIFenceDescriptor signalFence;
|
||||
externalImage->EndAccess(dawnTexture.Get(), &signalFence);
|
||||
dawnTexture.Destroy();
|
||||
}
|
||||
|
@ -630,7 +625,7 @@ TEST_P(D3DSharedHandleUsageTests, ClearInD3DReadbackInD3D11) {
|
|||
const wgpu::Color d3d11ClearColor{1.0f, 1.0f, 0.0f, 1.0f};
|
||||
wgpu::Texture dawnTexture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
std::unique_ptr<dawn::native::d3d::ExternalImageDXGI> externalImage;
|
||||
std::unique_ptr<native::d3d::ExternalImageDXGI> externalImage;
|
||||
WrapAndClearD3D11Texture(baseDawnDescriptor, baseD3dDescriptor, d3d11ClearColor, &dawnTexture,
|
||||
&d3d11Texture, &externalImage, /*isInitialized=*/true);
|
||||
ASSERT_NE(dawnTexture.Get(), nullptr);
|
||||
|
@ -638,7 +633,7 @@ TEST_P(D3DSharedHandleUsageTests, ClearInD3DReadbackInD3D11) {
|
|||
const wgpu::Color d3dClearColor{0.0f, 0.0f, 1.0f, 1.0f};
|
||||
ClearImage(dawnTexture, d3dClearColor, device);
|
||||
|
||||
dawn::native::d3d::ExternalImageDXGIFenceDescriptor signalFence;
|
||||
native::d3d::ExternalImageDXGIFenceDescriptor signalFence;
|
||||
externalImage->EndAccess(dawnTexture.Get(), &signalFence);
|
||||
dawnTexture.Destroy();
|
||||
|
||||
|
@ -662,7 +657,7 @@ TEST_P(D3DSharedHandleUsageTests, ClearTwiceInD3DReadbackInD3D11) {
|
|||
const wgpu::Color d3d11ClearColor{1.0f, 1.0f, 0.0f, 1.0f};
|
||||
wgpu::Texture dawnTexture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
std::unique_ptr<dawn::native::d3d::ExternalImageDXGI> externalImage;
|
||||
std::unique_ptr<native::d3d::ExternalImageDXGI> externalImage;
|
||||
WrapAndClearD3D11Texture(baseDawnDescriptor, baseD3dDescriptor, d3d11ClearColor, &dawnTexture,
|
||||
&d3d11Texture, &externalImage, /*isInitialized=*/true);
|
||||
ASSERT_NE(dawnTexture.Get(), nullptr);
|
||||
|
@ -673,7 +668,7 @@ TEST_P(D3DSharedHandleUsageTests, ClearTwiceInD3DReadbackInD3D11) {
|
|||
const wgpu::Color d3dClearColor2{0.0f, 1.0f, 1.0f, 1.0f};
|
||||
ClearImage(dawnTexture, d3dClearColor2, device);
|
||||
|
||||
dawn::native::d3d::ExternalImageDXGIFenceDescriptor signalFence;
|
||||
native::d3d::ExternalImageDXGIFenceDescriptor signalFence;
|
||||
externalImage->EndAccess(dawnTexture.Get(), &signalFence);
|
||||
dawnTexture.Destroy();
|
||||
|
||||
|
@ -692,7 +687,7 @@ TEST_P(D3DSharedHandleUsageTests, UninitializedTextureIsCleared) {
|
|||
const wgpu::Color clearColor{1.0f, 0.0f, 0.0f, 1.0f};
|
||||
wgpu::Texture dawnTexture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
std::unique_ptr<dawn::native::d3d::ExternalImageDXGI> externalImage;
|
||||
std::unique_ptr<native::d3d::ExternalImageDXGI> externalImage;
|
||||
WrapAndClearD3D11Texture(baseDawnDescriptor, baseD3dDescriptor, clearColor, &dawnTexture,
|
||||
&d3d11Texture, &externalImage, /*isInitialized=*/false);
|
||||
ASSERT_NE(dawnTexture.Get(), nullptr);
|
||||
|
@ -701,7 +696,7 @@ TEST_P(D3DSharedHandleUsageTests, UninitializedTextureIsCleared) {
|
|||
// to clear the source texture on the D3D device.
|
||||
EXPECT_PIXEL_RGBA8_EQ(utils::RGBA8(0, 0, 0, 0), dawnTexture, 0, 0);
|
||||
|
||||
dawn::native::d3d::ExternalImageDXGIFenceDescriptor signalFence;
|
||||
native::d3d::ExternalImageDXGIFenceDescriptor signalFence;
|
||||
externalImage->EndAccess(dawnTexture.Get(), &signalFence);
|
||||
dawnTexture.Destroy();
|
||||
}
|
||||
|
@ -715,7 +710,7 @@ TEST_P(D3DSharedHandleUsageTests, ReuseExternalImage) {
|
|||
// Create the first Dawn texture then clear it to red.
|
||||
wgpu::Texture texture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
std::unique_ptr<dawn::native::d3d::ExternalImageDXGI> externalImage;
|
||||
std::unique_ptr<native::d3d::ExternalImageDXGI> externalImage;
|
||||
WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture,
|
||||
&externalImage);
|
||||
{
|
||||
|
@ -728,12 +723,12 @@ TEST_P(D3DSharedHandleUsageTests, ReuseExternalImage) {
|
|||
|
||||
// Once finished with the first texture, destroy it so we may re-acquire the external image
|
||||
// again.
|
||||
dawn::native::d3d::ExternalImageDXGIFenceDescriptor signalFence;
|
||||
native::d3d::ExternalImageDXGIFenceDescriptor signalFence;
|
||||
externalImage->EndAccess(texture.Get(), &signalFence);
|
||||
texture.Destroy();
|
||||
|
||||
// Create another Dawn texture then clear it with another color.
|
||||
dawn::native::d3d::ExternalImageDXGIBeginAccessDescriptor externalAccessDesc;
|
||||
native::d3d::ExternalImageDXGIBeginAccessDescriptor externalAccessDesc;
|
||||
externalAccessDesc.isInitialized = true;
|
||||
externalAccessDesc.usage = static_cast<WGPUTextureUsageFlags>(baseDawnDescriptor.usage);
|
||||
externalAccessDesc.waitFences.push_back(signalFence);
|
||||
|
@ -774,7 +769,7 @@ TEST_P(D3DSharedHandleUsageTests, ConcurrentExternalImageReadAccess) {
|
|||
// Create Dawn texture with write access, then clear it to red.
|
||||
wgpu::Texture texture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
std::unique_ptr<dawn::native::d3d::ExternalImageDXGI> externalImage;
|
||||
std::unique_ptr<native::d3d::ExternalImageDXGI> externalImage;
|
||||
WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture,
|
||||
&externalImage);
|
||||
|
||||
|
@ -783,35 +778,35 @@ TEST_P(D3DSharedHandleUsageTests, ConcurrentExternalImageReadAccess) {
|
|||
ASSERT_NE(texture.Get(), nullptr);
|
||||
ClearImage(texture.Get(), solidRed, device);
|
||||
|
||||
dawn::native::d3d::ExternalImageDXGIFenceDescriptor signalFence;
|
||||
native::d3d::ExternalImageDXGIFenceDescriptor signalFence;
|
||||
externalImage->EndAccess(texture.Get(), &signalFence);
|
||||
texture.Destroy();
|
||||
|
||||
std::unique_ptr<dawn::native::d3d::ExternalImageDXGI> externalImage2 =
|
||||
std::unique_ptr<native::d3d::ExternalImageDXGI> externalImage2 =
|
||||
CreateExternalImage(device2.Get(), d3d11Texture.Get(), &baseDawnDescriptor);
|
||||
EXPECT_NE(externalImage2, nullptr);
|
||||
|
||||
std::unique_ptr<dawn::native::d3d::ExternalImageDXGI> externalImage3 =
|
||||
std::unique_ptr<native::d3d::ExternalImageDXGI> externalImage3 =
|
||||
CreateExternalImage(device3.Get(), d3d11Texture.Get(), &baseDawnDescriptor);
|
||||
EXPECT_NE(externalImage3, nullptr);
|
||||
|
||||
std::unique_ptr<dawn::native::d3d::ExternalImageDXGI> externalImage4 =
|
||||
std::unique_ptr<native::d3d::ExternalImageDXGI> externalImage4 =
|
||||
CreateExternalImage(device4.Get(), d3d11Texture.Get(), &baseDawnDescriptor);
|
||||
EXPECT_NE(externalImage4, nullptr);
|
||||
|
||||
std::unique_ptr<dawn::native::d3d::ExternalImageDXGI> externalImage5 =
|
||||
std::unique_ptr<native::d3d::ExternalImageDXGI> externalImage5 =
|
||||
CreateExternalImage(device5.Get(), d3d11Texture.Get(), &baseDawnDescriptor);
|
||||
EXPECT_NE(externalImage5, nullptr);
|
||||
|
||||
// Create two Dawn textures for concurrent read on second device.
|
||||
dawn::native::d3d::ExternalImageDXGIBeginAccessDescriptor externalAccessDesc;
|
||||
native::d3d::ExternalImageDXGIBeginAccessDescriptor externalAccessDesc;
|
||||
externalAccessDesc.isInitialized = true;
|
||||
externalAccessDesc.usage = WGPUTextureUsage_CopySrc;
|
||||
externalAccessDesc.waitFences = {signalFence};
|
||||
|
||||
// Concurrent read access on device 2 and 3.
|
||||
dawn::native::d3d::ExternalImageDXGIFenceDescriptor signalFence2;
|
||||
dawn::native::d3d::ExternalImageDXGIFenceDescriptor signalFence3;
|
||||
native::d3d::ExternalImageDXGIFenceDescriptor signalFence2;
|
||||
native::d3d::ExternalImageDXGIFenceDescriptor signalFence3;
|
||||
{
|
||||
wgpu::Texture texture2 =
|
||||
wgpu::Texture::Acquire(externalImage2->BeginAccess(&externalAccessDesc));
|
||||
|
@ -837,7 +832,7 @@ TEST_P(D3DSharedHandleUsageTests, ConcurrentExternalImageReadAccess) {
|
|||
externalAccessDesc.waitFences = {signalFence2, signalFence3};
|
||||
|
||||
// Exclusive read-write access on device 4.
|
||||
dawn::native::d3d::ExternalImageDXGIFenceDescriptor signalFence4;
|
||||
native::d3d::ExternalImageDXGIFenceDescriptor signalFence4;
|
||||
{
|
||||
wgpu::Texture texture4 =
|
||||
wgpu::Texture::Acquire(externalImage4->BeginAccess(&externalAccessDesc));
|
||||
|
@ -858,7 +853,7 @@ TEST_P(D3DSharedHandleUsageTests, ConcurrentExternalImageReadAccess) {
|
|||
externalAccessDesc.waitFences = {signalFence4};
|
||||
|
||||
// Import texture on device 5, but do nothing with it.
|
||||
dawn::native::d3d::ExternalImageDXGIFenceDescriptor signalFence5;
|
||||
native::d3d::ExternalImageDXGIFenceDescriptor signalFence5;
|
||||
{
|
||||
wgpu::Texture texture5 =
|
||||
wgpu::Texture::Acquire(externalImage5->BeginAccess(&externalAccessDesc));
|
||||
|
@ -914,16 +909,16 @@ TEST_P(D3DSharedHandleUsageTests, ExternalImageUsage) {
|
|||
|
||||
wgpu::Texture texture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
std::unique_ptr<dawn::native::d3d::ExternalImageDXGI> externalImage;
|
||||
std::unique_ptr<native::d3d::ExternalImageDXGI> externalImage;
|
||||
WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture,
|
||||
&externalImage);
|
||||
ASSERT_NE(texture.Get(), nullptr);
|
||||
|
||||
dawn::native::d3d::ExternalImageDXGIFenceDescriptor signalFence;
|
||||
native::d3d::ExternalImageDXGIFenceDescriptor signalFence;
|
||||
externalImage->EndAccess(texture.Get(), &signalFence);
|
||||
texture.Destroy();
|
||||
|
||||
dawn::native::d3d::ExternalImageDXGIBeginAccessDescriptor externalAccessDesc;
|
||||
native::d3d::ExternalImageDXGIBeginAccessDescriptor externalAccessDesc;
|
||||
externalAccessDesc.isInitialized = true;
|
||||
externalAccessDesc.usage = WGPUTextureUsage_StorageBinding;
|
||||
externalAccessDesc.waitFences.push_back(signalFence);
|
||||
|
@ -943,7 +938,7 @@ TEST_P(D3DSharedHandleUsageTests, InvalidateExternalImageOnDestroyDevice) {
|
|||
|
||||
wgpu::Texture texture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
std::unique_ptr<dawn::native::d3d::ExternalImageDXGI> externalImage;
|
||||
std::unique_ptr<native::d3d::ExternalImageDXGI> externalImage;
|
||||
|
||||
// Create the Dawn texture then clear it to red.
|
||||
WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture,
|
||||
|
@ -952,14 +947,14 @@ TEST_P(D3DSharedHandleUsageTests, InvalidateExternalImageOnDestroyDevice) {
|
|||
ASSERT_NE(texture.Get(), nullptr);
|
||||
ClearImage(texture.Get(), solidRed, device);
|
||||
|
||||
dawn::native::d3d::ExternalImageDXGIFenceDescriptor signalFence;
|
||||
native::d3d::ExternalImageDXGIFenceDescriptor signalFence;
|
||||
externalImage->EndAccess(texture.Get(), &signalFence);
|
||||
texture.Destroy();
|
||||
|
||||
// Do not readback pixels since that requires device to be alive during DawnTest::TearDown().
|
||||
DestroyDevice();
|
||||
|
||||
dawn::native::d3d::ExternalImageDXGIBeginAccessDescriptor externalAccessDesc;
|
||||
native::d3d::ExternalImageDXGIBeginAccessDescriptor externalAccessDesc;
|
||||
externalAccessDesc.isInitialized = true;
|
||||
externalAccessDesc.usage = static_cast<WGPUTextureUsageFlags>(baseDawnDescriptor.usage);
|
||||
|
||||
|
@ -972,7 +967,7 @@ TEST_P(D3DSharedHandleUsageTests, DisallowExternalImageAfterDestroyDevice) {
|
|||
|
||||
wgpu::Texture texture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
std::unique_ptr<dawn::native::d3d::ExternalImageDXGI> externalImage;
|
||||
std::unique_ptr<native::d3d::ExternalImageDXGI> externalImage;
|
||||
|
||||
DestroyDevice();
|
||||
|
||||
|
@ -990,7 +985,7 @@ TEST_P(D3DSharedHandleUsageTests, CallWriteBufferBeforeDestroyingExternalImage)
|
|||
|
||||
wgpu::Texture texture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
std::unique_ptr<dawn::native::d3d::ExternalImageDXGI> externalImage;
|
||||
std::unique_ptr<native::d3d::ExternalImageDXGI> externalImage;
|
||||
WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture,
|
||||
&externalImage);
|
||||
|
||||
|
@ -1000,7 +995,7 @@ TEST_P(D3DSharedHandleUsageTests, CallWriteBufferBeforeDestroyingExternalImage)
|
|||
wgpu::Buffer buffer = utils::CreateBufferFromData(
|
||||
device, wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst, {kExpected});
|
||||
|
||||
dawn::native::d3d::ExternalImageDXGIFenceDescriptor signalFence;
|
||||
native::d3d::ExternalImageDXGIFenceDescriptor signalFence;
|
||||
externalImage->EndAccess(texture.Get(), &signalFence);
|
||||
texture.Destroy();
|
||||
externalImage = nullptr;
|
||||
|
@ -1015,7 +1010,7 @@ TEST_P(D3DSharedHandleUsageTests, SRGBReinterpretation) {
|
|||
|
||||
wgpu::Texture texture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
std::unique_ptr<dawn::native::d3d::ExternalImageDXGI> externalImage;
|
||||
std::unique_ptr<native::d3d::ExternalImageDXGI> externalImage;
|
||||
|
||||
// The texture will be reinterpreted as sRGB.
|
||||
wgpu::TextureViewDescriptor viewDesc = {};
|
||||
|
@ -1071,13 +1066,13 @@ class D3DSharedHandleMultithreadTests : public D3DSharedHandleUsageTests {
|
|||
TEST_P(D3DSharedHandleMultithreadTests, DestroyDeviceBeforeImageNoDeadLock) {
|
||||
wgpu::Texture texture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
std::unique_ptr<dawn::native::d3d::ExternalImageDXGI> externalImage;
|
||||
std::unique_ptr<native::d3d::ExternalImageDXGI> externalImage;
|
||||
WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture,
|
||||
&externalImage);
|
||||
|
||||
ASSERT_NE(texture.Get(), nullptr);
|
||||
|
||||
dawn::native::d3d::ExternalImageDXGIFenceDescriptor signalFence;
|
||||
native::d3d::ExternalImageDXGIFenceDescriptor signalFence;
|
||||
externalImage->EndAccess(texture.Get(), &signalFence);
|
||||
EXPECT_TRUE(externalImage->IsValid());
|
||||
|
||||
|
@ -1091,7 +1086,7 @@ TEST_P(D3DSharedHandleMultithreadTests, DestroyDeviceBeforeImageNoDeadLock) {
|
|||
TEST_P(D3DSharedHandleMultithreadTests, DestroyDeviceAndUseImageInParallel) {
|
||||
wgpu::Texture texture;
|
||||
ComPtr<ID3D11Texture2D> d3d11Texture;
|
||||
std::unique_ptr<dawn::native::d3d::ExternalImageDXGI> externalImage;
|
||||
std::unique_ptr<native::d3d::ExternalImageDXGI> externalImage;
|
||||
WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture,
|
||||
&externalImage);
|
||||
|
||||
|
@ -1099,7 +1094,7 @@ TEST_P(D3DSharedHandleMultithreadTests, DestroyDeviceAndUseImageInParallel) {
|
|||
EXPECT_TRUE(externalImage->IsValid());
|
||||
|
||||
std::thread thread1([&] {
|
||||
dawn::native::d3d::ExternalImageDXGIFenceDescriptor signalFence;
|
||||
native::d3d::ExternalImageDXGIFenceDescriptor signalFence;
|
||||
externalImage->EndAccess(texture.Get(), &signalFence);
|
||||
});
|
||||
|
||||
|
@ -1133,11 +1128,11 @@ TEST_P(D3DSharedHandleMultithreadTests, ClearInD3D12ReadbackInD3D11_TwoThreads)
|
|||
CreateSharedD3D11Texture(baseD3dDescriptor, &d3d11Texture, &d3d11Fence, &sharedHandle,
|
||||
&fenceSharedHandle);
|
||||
|
||||
dawn::native::d3d::ExternalImageDXGIFenceDescriptor d3dSignalFence;
|
||||
native::d3d::ExternalImageDXGIFenceDescriptor d3dSignalFence;
|
||||
|
||||
std::thread d3dThread([=, &d3dSignalFence] {
|
||||
wgpu::Texture dawnTexture;
|
||||
std::unique_ptr<dawn::native::d3d::ExternalImageDXGI> externalImage;
|
||||
std::unique_ptr<native::d3d::ExternalImageDXGI> externalImage;
|
||||
WaitAndWrapD3D11Texture(baseDawnDescriptor, sharedHandle, fenceSharedHandle,
|
||||
/*fenceWaitValue=*/kD3D11FenceSignalValue, &dawnTexture,
|
||||
&externalImage, /*isInitialized=*/true);
|
||||
|
@ -1176,3 +1171,6 @@ TEST_P(D3DSharedHandleMultithreadTests, ClearInD3D12ReadbackInD3D11_TwoThreads)
|
|||
DAWN_INSTANTIATE_TEST(D3DSharedHandleValidation, D3D11Backend(), D3D12Backend());
|
||||
DAWN_INSTANTIATE_TEST(D3DSharedHandleUsageTests, D3D11Backend(), D3D12Backend());
|
||||
DAWN_INSTANTIATE_TEST(D3DSharedHandleMultithreadTests, D3D11Backend(), D3D12Backend());
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
|
||||
#include "dawn/utils/WGPUHelpers.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
class DebugMarkerTests : public DawnTest {};
|
||||
|
||||
// Make sure that calling a marker API without a debugging tool attached doesn't cause a failure.
|
||||
|
@ -52,3 +55,6 @@ DAWN_INSTANTIATE_TEST(DebugMarkerTests,
|
|||
OpenGLBackend(),
|
||||
OpenGLESBackend(),
|
||||
VulkanBackend());
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
#include "dawn/utils/TextureUtils.h"
|
||||
#include "dawn/utils/WGPUHelpers.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
constexpr static unsigned int kRTSize = 2;
|
||||
|
||||
enum class QuadAngle { Flat, TiltedX };
|
||||
|
@ -396,3 +399,6 @@ DAWN_INSTANTIATE_TEST(DepthBiasTests,
|
|||
OpenGLBackend(),
|
||||
OpenGLESBackend(),
|
||||
VulkanBackend());
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -25,7 +25,9 @@
|
|||
#include "dawn/utils/TextureUtils.h"
|
||||
#include "dawn/utils/WGPUHelpers.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
using TextureFormat = wgpu::TextureFormat;
|
||||
DAWN_TEST_PARAM_STRUCT(DepthStencilCopyTestParams, TextureFormat);
|
||||
|
||||
|
@ -38,7 +40,6 @@ constexpr std::array<wgpu::TextureFormat, 3> kValidDepthCopyTextureFormats = {
|
|||
constexpr std::array<wgpu::TextureFormat, 1> kValidDepthCopyFromBufferFormats = {
|
||||
wgpu::TextureFormat::Depth16Unorm,
|
||||
};
|
||||
} // namespace
|
||||
|
||||
class DepthStencilCopyTests : public DawnTestWithParams<DepthStencilCopyTestParams> {
|
||||
protected:
|
||||
|
@ -1093,3 +1094,6 @@ DAWN_INSTANTIATE_TEST_P(
|
|||
std::vector<wgpu::TextureFormat>{wgpu::TextureFormat::Depth16Unorm,
|
||||
wgpu::TextureFormat::Depth32FloatStencil8,
|
||||
wgpu::TextureFormat::Depth24Plus});
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "dawn/utils/ComboRenderPipelineDescriptor.h"
|
||||
#include "dawn/utils/WGPUHelpers.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
using Format = wgpu::TextureFormat;
|
||||
|
@ -420,4 +421,5 @@ DAWN_INSTANTIATE_TEST_P(DepthTextureClearTwiceTest,
|
|||
wgpu::TextureFormat::Depth24PlusStencil8},
|
||||
{true, false});
|
||||
|
||||
} // namespace
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -20,7 +20,9 @@
|
|||
#include "dawn/utils/ComboRenderPipelineDescriptor.h"
|
||||
#include "dawn/utils/WGPUHelpers.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
using TextureFormat = wgpu::TextureFormat;
|
||||
DAWN_TEST_PARAM_STRUCT(DepthStencilSamplingTestParams, TextureFormat);
|
||||
|
||||
|
@ -40,8 +42,6 @@ const std::vector<float> kNormalizedTextureValues = {0.0, 0.3, 0.4, 0.5, 1.0};
|
|||
// Test the limits, and some values in between.
|
||||
const std::vector<uint32_t> kStencilValues = {0, 1, 38, 255};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
class DepthStencilSamplingTest : public DawnTestWithParams<DepthStencilSamplingTestParams> {
|
||||
protected:
|
||||
enum class TestAspectAndSamplerType {
|
||||
|
@ -938,3 +938,6 @@ DAWN_INSTANTIATE_TEST_P(StencilSamplingTest,
|
|||
OpenGLBackend(), OpenGLESBackend(), VulkanBackend()},
|
||||
std::vector<wgpu::TextureFormat>(utils::kStencilFormats.begin(),
|
||||
utils::kStencilFormats.end()));
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
#include "dawn/utils/ComboRenderPipelineDescriptor.h"
|
||||
#include "dawn/utils/WGPUHelpers.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
constexpr static unsigned int kRTSize = 64;
|
||||
|
||||
class DepthStencilStateTest : public DawnTest {
|
||||
|
@ -847,3 +850,6 @@ DAWN_INSTANTIATE_TEST(DepthStencilStateTest,
|
|||
OpenGLESBackend(),
|
||||
VulkanBackend({"vulkan_use_d32s8"}, {}),
|
||||
VulkanBackend({}, {"vulkan_use_d32s8"}));
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
#include "dawn/utils/ComboRenderPipelineDescriptor.h"
|
||||
#include "dawn/utils/WGPUHelpers.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
using ::testing::HasSubstr;
|
||||
|
||||
constexpr uint32_t kRTSize = 4;
|
||||
|
@ -219,3 +222,6 @@ DAWN_INSTANTIATE_TEST(DestroyTest,
|
|||
OpenGLBackend(),
|
||||
OpenGLESBackend(),
|
||||
VulkanBackend());
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -21,9 +21,12 @@
|
|||
#include "dawn/utils/SystemUtils.h"
|
||||
#include "dawn/utils/WGPUHelpers.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
class DeviceInitializationTest : public testing::Test {
|
||||
protected:
|
||||
void SetUp() override { dawnProcSetProcs(&dawn::native::GetProcs()); }
|
||||
void SetUp() override { dawnProcSetProcs(&native::GetProcs()); }
|
||||
|
||||
void TearDown() override { dawnProcSetProcs(nullptr); }
|
||||
|
||||
|
@ -73,10 +76,10 @@ TEST_F(DeviceInitializationTest, DeviceOutlivesInstance) {
|
|||
// We want to create a device on a fresh instance and adapter each time.
|
||||
std::vector<wgpu::AdapterProperties> availableAdapterProperties;
|
||||
{
|
||||
auto instance = std::make_unique<dawn::native::Instance>();
|
||||
auto instance = std::make_unique<native::Instance>();
|
||||
instance->EnableAdapterBlocklist(false);
|
||||
instance->DiscoverDefaultAdapters();
|
||||
for (const dawn::native::Adapter& adapter : instance->GetAdapters()) {
|
||||
for (const native::Adapter& adapter : instance->GetAdapters()) {
|
||||
wgpu::AdapterProperties properties;
|
||||
adapter.GetProperties(&properties);
|
||||
|
||||
|
@ -91,10 +94,10 @@ TEST_F(DeviceInitializationTest, DeviceOutlivesInstance) {
|
|||
for (const wgpu::AdapterProperties& desiredProperties : availableAdapterProperties) {
|
||||
wgpu::Device device;
|
||||
|
||||
auto instance = std::make_unique<dawn::native::Instance>();
|
||||
auto instance = std::make_unique<native::Instance>();
|
||||
instance->EnableAdapterBlocklist(false);
|
||||
instance->DiscoverDefaultAdapters();
|
||||
for (dawn::native::Adapter& adapter : instance->GetAdapters()) {
|
||||
for (native::Adapter& adapter : instance->GetAdapters()) {
|
||||
wgpu::AdapterProperties properties;
|
||||
adapter.GetProperties(&properties);
|
||||
|
||||
|
@ -122,10 +125,10 @@ TEST_F(DeviceInitializationTest, AdapterOutlivesInstance) {
|
|||
// We want to create a device on a fresh instance and adapter each time.
|
||||
std::vector<wgpu::AdapterProperties> availableAdapterProperties;
|
||||
{
|
||||
auto instance = std::make_unique<dawn::native::Instance>();
|
||||
auto instance = std::make_unique<native::Instance>();
|
||||
instance->EnableAdapterBlocklist(false);
|
||||
instance->DiscoverDefaultAdapters();
|
||||
for (const dawn::native::Adapter& adapter : instance->GetAdapters()) {
|
||||
for (const native::Adapter& adapter : instance->GetAdapters()) {
|
||||
wgpu::AdapterProperties properties;
|
||||
adapter.GetProperties(&properties);
|
||||
|
||||
|
@ -143,14 +146,14 @@ TEST_F(DeviceInitializationTest, AdapterOutlivesInstance) {
|
|||
for (const wgpu::AdapterProperties& desiredProperties : availableAdapterProperties) {
|
||||
wgpu::Adapter adapter;
|
||||
|
||||
auto instance = std::make_unique<dawn::native::Instance>();
|
||||
auto instance = std::make_unique<native::Instance>();
|
||||
instance->EnableAdapterBlocklist(false);
|
||||
// Save a pointer to the instance.
|
||||
// It will only be valid as long as the instance is alive.
|
||||
WGPUInstance unsafeInstancePtr = instance->Get();
|
||||
|
||||
instance->DiscoverDefaultAdapters();
|
||||
for (dawn::native::Adapter& nativeAdapter : instance->GetAdapters()) {
|
||||
for (native::Adapter& nativeAdapter : instance->GetAdapters()) {
|
||||
wgpu::AdapterProperties properties;
|
||||
nativeAdapter.GetProperties(&properties);
|
||||
|
||||
|
@ -164,9 +167,9 @@ TEST_F(DeviceInitializationTest, AdapterOutlivesInstance) {
|
|||
// holding onto the instance. The instance should have cleared all internal
|
||||
// references to adapters when the last external ref is dropped.
|
||||
adapter = wgpu::Adapter(nativeAdapter.Get());
|
||||
EXPECT_GT(dawn::native::GetAdapterCountForTesting(unsafeInstancePtr), 0u);
|
||||
EXPECT_GT(native::GetAdapterCountForTesting(unsafeInstancePtr), 0u);
|
||||
instance.reset();
|
||||
EXPECT_EQ(dawn::native::GetAdapterCountForTesting(unsafeInstancePtr), 0u);
|
||||
EXPECT_EQ(native::GetAdapterCountForTesting(unsafeInstancePtr), 0u);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -176,3 +179,6 @@ TEST_F(DeviceInitializationTest, AdapterOutlivesInstance) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
#include "dawn/tests/DawnTest.h"
|
||||
#include "dawn/utils/WGPUHelpers.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
class DeviceLifetimeTests : public DawnTest {};
|
||||
|
||||
// Test that the device can be dropped before its queue.
|
||||
|
@ -557,3 +560,6 @@ DAWN_INSTANTIATE_TEST(DeviceLifetimeTests,
|
|||
OpenGLBackend(),
|
||||
OpenGLESBackend(),
|
||||
VulkanBackend());
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
#include "dawn/utils/WGPUHelpers.h"
|
||||
#include "gmock/gmock.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
using testing::_;
|
||||
using testing::Exactly;
|
||||
using testing::MockCallback;
|
||||
|
@ -540,3 +543,6 @@ DAWN_INSTANTIATE_TEST(DeviceLostTest,
|
|||
OpenGLBackend(),
|
||||
OpenGLESBackend(),
|
||||
VulkanBackend());
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
#include "dawn/utils/ComboRenderPipelineDescriptor.h"
|
||||
#include "dawn/utils/WGPUHelpers.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
constexpr uint32_t kRTSize = 4;
|
||||
|
||||
class DrawIndexedIndirectTest : public DawnTest {
|
||||
|
@ -716,3 +719,6 @@ DAWN_INSTANTIATE_TEST(DrawIndexedIndirectTest,
|
|||
OpenGLBackend(),
|
||||
OpenGLESBackend(),
|
||||
VulkanBackend());
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
#include "dawn/utils/ComboRenderPipelineDescriptor.h"
|
||||
#include "dawn/utils/WGPUHelpers.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
constexpr uint32_t kRTSize = 4;
|
||||
|
||||
class DrawIndexedTest : public DawnTest {
|
||||
|
@ -162,3 +165,6 @@ DAWN_INSTANTIATE_TEST(DrawIndexedTest,
|
|||
OpenGLBackend(),
|
||||
OpenGLESBackend(),
|
||||
VulkanBackend());
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
#include "dawn/utils/ComboRenderPipelineDescriptor.h"
|
||||
#include "dawn/utils/WGPUHelpers.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
constexpr uint32_t kRTSize = 4;
|
||||
|
||||
class DrawIndirectTest : public DawnTest {
|
||||
|
@ -135,3 +138,6 @@ DAWN_INSTANTIATE_TEST(DrawIndirectTest,
|
|||
OpenGLBackend(),
|
||||
OpenGLESBackend(),
|
||||
VulkanBackend());
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
#include "dawn/utils/ComboRenderPipelineDescriptor.h"
|
||||
#include "dawn/utils/WGPUHelpers.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
constexpr uint32_t kRTSize = 4;
|
||||
|
||||
class DrawTest : public DawnTest {
|
||||
|
@ -107,3 +110,6 @@ DAWN_INSTANTIATE_TEST(DrawTest,
|
|||
OpenGLBackend(),
|
||||
OpenGLESBackend(),
|
||||
VulkanBackend());
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
#include "dawn/utils/ComboRenderPipelineDescriptor.h"
|
||||
#include "dawn/utils/WGPUHelpers.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
constexpr uint32_t kRTSize = 400;
|
||||
constexpr uint32_t kBindingSize = 8;
|
||||
|
||||
|
@ -586,3 +589,6 @@ DAWN_INSTANTIATE_TEST_P(ClampedOOBDynamicBufferOffsetTests,
|
|||
{wgpu::BufferUsage::Uniform, wgpu::BufferUsage::Storage},
|
||||
{false, true},
|
||||
{false, true});
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
#include "dawn/utils/ComboRenderPipelineDescriptor.h"
|
||||
#include "dawn/utils/WGPUHelpers.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
class EntryPointTests : public DawnTest {};
|
||||
|
||||
// Test creating a render pipeline from two entryPoints in the same module.
|
||||
|
@ -149,3 +152,6 @@ DAWN_INSTANTIATE_TEST(EntryPointTests,
|
|||
OpenGLBackend(),
|
||||
OpenGLESBackend(),
|
||||
VulkanBackend());
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -17,12 +17,12 @@
|
|||
#include "dawn/tests/DawnTest.h"
|
||||
#include "dawn/utils/WGPUHelpers.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
using RequestDP4aExtension = bool;
|
||||
DAWN_TEST_PARAM_STRUCT(ExperimentalDP4aTestsParams, RequestDP4aExtension);
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
class ExperimentalDP4aTests : public DawnTestWithParams<ExperimentalDP4aTestsParams> {
|
||||
protected:
|
||||
std::vector<wgpu::FeatureName> GetRequiredFeatures() override {
|
||||
|
@ -136,3 +136,6 @@ DAWN_INSTANTIATE_TEST_P(ExperimentalDP4aTests,
|
|||
VulkanBackend(),
|
||||
},
|
||||
{true, false});
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "dawn/utils/ComboRenderPipelineDescriptor.h"
|
||||
#include "dawn/utils/WGPUHelpers.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
wgpu::Texture Create2DTexture(wgpu::Device device,
|
||||
|
@ -107,7 +108,6 @@ class ExternalTextureTests : public DawnTest {
|
|||
wgpu::ShaderModule vsModule;
|
||||
wgpu::ShaderModule fsSampleExternalTextureModule;
|
||||
};
|
||||
} // anonymous namespace
|
||||
|
||||
TEST_P(ExternalTextureTests, CreateExternalTextureSuccess) {
|
||||
wgpu::Texture texture = Create2DTexture(device, kWidth, kHeight, kFormat, kSampledUsage);
|
||||
|
@ -1002,3 +1002,6 @@ DAWN_INSTANTIATE_TEST(ExternalTextureTests,
|
|||
OpenGLBackend(),
|
||||
OpenGLESBackend(),
|
||||
VulkanBackend());
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -21,6 +21,9 @@
|
|||
#include "dawn/utils/ComboRenderPipelineDescriptor.h"
|
||||
#include "dawn/utils/WGPUHelpers.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
constexpr uint32_t kRTSize = 1;
|
||||
|
||||
enum class DrawMode {
|
||||
|
@ -39,12 +42,14 @@ bool IsIndirectDraw(DrawMode mode) {
|
|||
return mode == DrawMode::NonIndexedIndirect || mode == DrawMode::IndexedIndirect;
|
||||
}
|
||||
|
||||
namespace dawn {
|
||||
} // anonymous namespace
|
||||
|
||||
template <>
|
||||
struct IsDawnBitmask<CheckIndex> {
|
||||
static constexpr bool enable = true;
|
||||
};
|
||||
} // namespace dawn
|
||||
|
||||
namespace {
|
||||
|
||||
class FirstIndexOffsetTests : public DawnTest {
|
||||
public:
|
||||
|
@ -328,3 +333,6 @@ DAWN_INSTANTIATE_TEST(FirstIndexOffsetTests,
|
|||
OpenGLBackend(),
|
||||
OpenGLESBackend(),
|
||||
VulkanBackend());
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
#include "dawn/utils/ComboRenderPipelineDescriptor.h"
|
||||
#include "dawn/utils/WGPUHelpers.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
constexpr wgpu::TextureFormat kDepthFormat = wgpu::TextureFormat::Depth32Float;
|
||||
|
||||
class FragDepthTests : public DawnTest {};
|
||||
|
@ -233,3 +236,6 @@ DAWN_INSTANTIATE_TEST(FragDepthTests,
|
|||
OpenGLBackend(),
|
||||
OpenGLESBackend(),
|
||||
VulkanBackend());
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
#include "dawn/utils/ComboRenderPipelineDescriptor.h"
|
||||
#include "dawn/utils/WGPUHelpers.h"
|
||||
|
||||
namespace dawn {
|
||||
namespace {
|
||||
|
||||
class GpuMemorySyncTests : public DawnTest {
|
||||
protected:
|
||||
wgpu::Buffer CreateBuffer() {
|
||||
|
@ -654,3 +657,6 @@ DAWN_INSTANTIATE_TEST(MultipleWriteThenMultipleReadTests,
|
|||
OpenGLBackend(),
|
||||
OpenGLESBackend(),
|
||||
VulkanBackend());
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace dawn
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue