I have a Windows.Graphics.DirectX.Direct3D11.IDirect3DSurface - how do I get a pointer to the graphics data to operate on? Write a C++/winrt sample if you can.
OK, next up, split the locked bytes into a std::vector<> of NV12 plane definitions.
| // C++ caller | |
| void DownloadTheThing(Thing const& thing) { | |
| auto op { thing.DownloadAsync(L"arg1", L"arg2") }; | |
| op.Progress([](auto const &pending, uint32_t progress) { | |
| // Handle progress update | |
| wprintf(L"Download progress: %u%%\n", progress); | |
| }); | |
| var result = op.get(); // Await completion | |
| if (result.StatusIsSuccess) { | |
| // use result.Result |
| #include <wil/wistd_type_traits.h> | |
| #include <wil/resource.h> | |
| template<typename Q> struct bucketed_hash | |
| { | |
| struct entry | |
| { | |
| uint32_t thread_id; | |
| wil::unique_process_heap_ptr<entry> next; | |
| Q value; |
| import os | |
| import sys | |
| import subprocess | |
| import urllib.request | |
| import argparse | |
| from pathlib import Path | |
| wasdk = { | |
| "name": "Microsoft.WindowsAppSDK", | |
| "version": "1.7.250127003-experimental3", |
| #include <winrt/base.h> | |
| /* Assume this type: | |
| runtimeclass Foo { | |
| String Name; | |
| UInt32 Id { get; }; | |
| Foo[] GetMoreFoos(); | |
| } |
| // ConsoleApplication1.cpp : This file contains the 'main' function. Program execution begins and ends there. | |
| // | |
| #include <iostream> | |
| #include <map> | |
| #include <chrono> | |
| #include <unordered_map> | |
| #include <array> | |
| #include <string> | |
| #include <functional> |
| // https://godbolt.org/z/xnd359j99 | |
| #include <optional> | |
| #include <mutex> | |
| #include <functional> | |
| template<typename T> struct default_lazy_init { | |
| T operator()() const { | |
| return T{}; | |
| } |
| #include <vector> | |
| #include <span> | |
| #include <variant> | |
| #include <memory> | |
| template<typename T, int internal = 25> struct small_vector_optimization : std::span<T const> | |
| { | |
| small_vector_optimization(std::span<T const> src) | |
| { | |
| if (src.size() <= internal) |
| // This is replacement for std::format on systems that don't have std::locale support, | |
| // but do have std::to_chars locale invariant. | |
| template <typename... Args> | |
| std::string myformat(std::format_string<Args...> fmt, Args&&... args) | |
| { | |
| std::string output; | |
| auto formatArgStore = std::make_format_args(args...); | |
| auto formatArgs = std::format_args(formatArgStore); | |
| std::string_view fmtString = fmt.get(); | |
| int nextIndex = 0; |