vlj

Members
  • Content count

    259
  • Joined

  • Last visited

Community Reputation

1070 Excellent

About vlj

  • Rank
    Member
  1. I found this article which describes a simple network with 3 chained clamped convolution layers : https://arxiv.org/pdf/1501.00092.pdf On a high level view the layers act as feature extraction, feature mapping (ie moreless fetching in a dictionnary what is the closest candidate) and feature reconstruction. What I dont understand is how the network is applied : does it takes a whole image as input and returns a whole image or does it takes a subset of the pictures and return a pixel in the reconstructed picture ? In the latter case how does it deal with image border then ? I'm thinking at rather generic texture (like grass, dirt, wood). Hopefully it may be useful to improve texture resolution in old titles while keeping general aspect.
  2. There was some outstanding demo of deep neural network being developed for artistic purpose. Google wrote deep dream which mix a content image and a style image and output an image combining both. Neural doodle extend the idea by taking a single 4 color map and output a "Monnet like" picture. I wonder if it is possible to create and train a dnn that could upscale a texture. I know it has been done for manga/anime picture, and neural doodle can be used to "transfer" high resolution picture on minecraft blocky texture. Unfortunately I have no experience with dnn. I know the theory behind neural network and I know the math Def of a convolution however I think I'm missing some knowledge to correctly understand dnn articles and latest evolution. Is there some "dnn theory for game dev" resources available and can the technic be used to upscale texture?
  3. Unfortunately the feature seems very buggy, I'm getting lot of compiler crashes.
  4. I'm trying to use the module features introduced in VS2015 and which was unfortunatly rejected for inclusion in C++17 but is still a TS. Basically module adds an "import" mechanism in C++ that replaces includes and should heavily speeds up build time. Unfortunatly while CL is able to produce and consume and module, Visual Studio 2015 doesn't support it. Luckily adding some flags to the CL command line is easy and I'm able to use module inside my project. The issue is that intellisense doesn't recognise the "import" directive and can't import module binary data at the moment. This means that I'm getting wrong color syntaxing which is annoying. For compatibility with others compilers I wrapped the import directive inside an #ifdef MODULE_ENABLED and I wonder if it is possible to make Intellisense parse without this define and still have it enabled when building ? Currently it looks like intellisense is picking the same defines as the one used in vcxproj.
  5. I don't know how your shader does work but if every normal are pointing to the same direction then the edge illumination looks wrong when lit by a point light. The light amount depends on normal and depth. Since normal is constant and depth doesn't vary by a wide margin you should get a similar halo as when your light is in the middle of the surface, and not this penumbra. Another argument is that since depth is continuous and diffuse is too, you should get continuous illumination but here there's a visible boundary.
  6. I would recommend using for_each until you get the habit of looking at <algorithm> before implementing your own. There are some of very nice function like rotate, stable partition that goes almost unnoticed. Of course there is likely no difference in performance between a range for and for_each and there is a big temptation to roll your own version of replace_if or fill since they are trivial but you'll probably win a lot if you practice some functional programming. In addition parallel version of for_each may be added to c++ 17 meaning that you just have to change the function name in your calls if you think they can benefit from it.
  7. I don't understand your first question. A command buffer can use several render pass. You can use a single command buffer to draw a whole frame, which involve multiple passes (because of Shadow map, post processing on quarter size frame buffer...) AFAIK a render pass can't span over several command buffer. A command buffer state is undefined when it is "started", bindings are not carried over. One exception though:you can execute separate secondary command buffer inside a subpass. You need to inform the command buffer begin command about this however.
  8. what good are cores?

    By the way what is a job system? Looking at the various link provided it seems very close to the "task" structure in openmp 3 (unfortunately not supported by msvc) or in the upcoming c++17 standard. On the other hand task can create subtasks that can be picked by other thread depending on the scheduler while it looks like all job are generated by main thread while others threads are picking a job.
  9. I went the other way, I throwed UWP code and wrapped my code in a C# app. It works as good as a nested Hwnd window can in a Xaml environment ie with airspace problem.
  10. It's always possible to access any data in an atomic manner using a compareswap in a loop. Something like Do {floatval = old value + ... } while(compareswap(oldvalue, floatvalue)); It will loop as long as the atomic data is different from old value. If the atomic is equal to old value it will atomically swap it with floatvalue and exit the loop. I'm not sure this pattern is efficient. On the other hand from my experience amd atomic are way faster than Nvidia's one and that's maybe why they provide float atomic to make you avoid resorting to slower pattern.
  11. I would rather stay away from c++/cli since it looks like it's being deprecated by MS and it's not portable. While the clr is currently on Windows only there is mono and net core for Linux and other platforms.
  12. In C++ the order of the member in a class is the order in which they are initialized. It's also the reverse order in which they're destroyed. The issue is that a struct layout may have a semantic of it's own. For instance the order of member matters for langage interop, for alignment (although it can be mitigated with alignas) ; structure layout can have some implications in how cache friendly it is. I wonder if there is a way to decouple initialisation order from the structure layout and if it has been considered by C++ comitee.
  13. I'm trying to use the CLR as a script engine in my C++ code. I'm hosting a CLR instance which works as expected. However I'd like to expose native functions to the CLR so that script code can have an interface to my C++ data. Issue with PInvoke is that there is no DLL, my application is a standalone executable. As far as I know PInvoke only works on dll provided function (Mono seems to have an DllImport("__internal") which is able to fetch dll in the process address space but I didn't test it). I can split my app in an exe and a .dll but wouldn't that means the dll will be loaded twice ?
  14. In a C++ project I'm hosting a .Net CLR and load an assembly with an HelloWorld function with the following code (compiled as 64 bits) : struct _FooInterface : IUnknown { virtual HRESULT __stdcall HelloWorld(LPWSTR name, LPWSTR* result, void* ptr) = 0; }; extern "C" { void __cdecl test_func(int); } void main() { Microsoft::WRL::ComPtr<ICLRMetaHost> pMetaHost; Microsoft::WRL::ComPtr<ICLRRuntimeInfo> pRuntimeInfo; HRESULT hr; CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); hr = CLRCreateInstance(CLSID_CLRMetaHost, IID_PPV_ARGS(pMetaHost.GetAddressOf())); hr = pMetaHost->GetRuntime(L"v4.0.30319", IID_PPV_ARGS(pRuntimeInfo.GetAddressOf())); hr = pRuntimeInfo->GetInterface(CLSID_CLRRuntimeHost, IID_PPV_ARGS(pRuntimeHost.GetAddressOf())); SampleHostControl* hostControl = new SampleHostControl(); hr = pRuntimeHost->SetHostControl((IHostControl *)hostControl); ICLRControl* pCLRControl = nullptr; hr = pRuntimeHost->GetCLRControl(&pCLRControl); LPCWSTR assemblyName = L"mesh_managed"; LPCWSTR appDomainManagerTypename = L"mesh_managed.CustomAppDomainManager"; hr = pCLRControl->SetAppDomainManagerType(assemblyName, appDomainManagerTypename); hr = pRuntimeHost->Start(); LPWSTR text; _FooInterface* appDomainManager = hostControl->GetFooInterface(); hr = appDomainManager->HelloWorld(L"Player One", &text, &test_func); hr = pRuntimeHost->Stop(); }   For reference the code of host control class is : class SampleHostControl : IHostControl { public: SampleHostControl() { m_refCount = 0; m_defaultDomainManager = NULL; } virtual ~SampleHostControl() { if (m_defaultDomainManager != NULL) { m_defaultDomainManager->Release(); } } HRESULT __stdcall SampleHostControl::GetHostManager(REFIID id, void **ppHostManager) { *ppHostManager = NULL; return E_NOINTERFACE; } HRESULT __stdcall SampleHostControl::SetAppDomainManager(DWORD dwAppDomainID, IUnknown *pUnkAppDomainManager) { HRESULT hr = S_OK; hr = pUnkAppDomainManager->QueryInterface(__uuidof(_FooInterface), (PVOID*)&m_defaultDomainManager); return hr; } _FooInterface* GetFooInterface() { if (m_defaultDomainManager) { m_defaultDomainManager->AddRef(); } return m_defaultDomainManager; } HRESULT __stdcall QueryInterface(const IID &iid, void **ppv) { if (!ppv) return E_POINTER; *ppv = this; AddRef(); return S_OK; } ULONG __stdcall AddRef() { return InterlockedIncrement(&m_refCount); } ULONG __stdcall Release() { if (InterlockedDecrement(&m_refCount) == 0) { delete this; return 0; } return m_refCount; } private: long m_refCount; _FooInterface* m_defaultDomainManager; }; (took it from a blog post)   In my C# code I declare the following interface that mirror the _FooInterface one : [ComImport, Guid("A15DDC0D-53EF-4776-8DA2-E87399C6654D"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface Interface1 { [return: MarshalAs(UnmanagedType.LPWStr)] string HelloWorld([MarshalAs(UnmanagedType.LPWStr)] string name, IntPtr test_function); } Then I'm implementing the appDomain and the helloWorld function as : namespace mesh_managed { public sealed class CustomAppDomainManager : AppDomainManager, Interface1 { [UnmanagedFunctionPointer(CallingConvention.Cdecl)] unsafe public delegate void test_function_ptr(int i); public CustomAppDomainManager() { } public override void InitializeNewDomain(AppDomainSetup appDomainInfo) { this.InitializationFlags = AppDomainManagerInitializationOptions.RegisterWithHost; } [STAThread] public string HelloWorld(string name, IntPtr ptr) { var test_function = Marshal.GetDelegateForFunctionPointer<test_function_ptr>(ptr); test_function(0); return "Hello " + name; } } } (it's just a test function)   Unfortunatly the test_function(0) call doesn't work here in the assembly : an exception "An unhandled exception of type 'System.AccessViolationException' occurred in mesh_managed.dll" is thrown. If I remove the test_function(0) call everything seem to work as expected, the string is correctly return in the C++ side.   What am I doing wrong ? I'd like to expose an API to the CLR so that I can manipulate data with C#. There is no dll so I can't use DLLImport feature and I prefer to have C++ embed C# than the opposite.   Regards, Vincent.