Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Everything posted by Tank202

  1. Hello,   I wanted to know how to return compute shader results back to CPU so that I can use it for application logics level computations. I have running compute shader on DirectX11 but I don't know how to convert results from unordered access view to my base structure on CPU. How do I do that?
  2. Tank202

    Compute shader values

    On the other hand I see that you can specify wether directx should wait for result of compute shader or not... So maybe problematic result reading is not necessary?
  3. Tank202

    Compute shader values

    Thanks for information. Looking forward to implement them.
  4. Hello there,   I'm trying to run my shader in direct2d. I've written very similar code to this but when I try to run it, the program stops and my error reporting code displays message that 'element not found'(HRESULT Error string).   The difficulty is that no error reporting inside shader wrapper implementation is possible so I cant myself track whats causing it to crash... I need some experienced folks explain me whats happening wrong there.   I really need to get this done so if you need, ask for information, source, etc... I will provide everything.
  5. Tank202

    Opinions needed

    OK then :D GL came first, but regarding functionality DirectX is the leading force. For example tessellation firstly became available on DX and then after a year on GL.   Nevertheless DirectX and Visual Studio in my eyes is the only path for Windows OS game. If it is not Windows OS game you want to make, then you have no other choice but to use OpenGL and Code::Blocks(probably).    Good luck with whatever you will be creating.
  6. Tank202

    Opinions needed

    I vote for DX11 you wont get better performance on PC. Thinking about OpenGL... Well... It is very... abstract as a library... And to tell the truth OpenGL always was just a copy of DX functionality. So GO GO GO DirectX11.
  7. Hello there,   I'm trying to play audio from *.ogg format. However I'm having a bit of problem as XAudio2 won't create source voice for me. One woulp probably say that I am probably not filling whole WAVEFORMATEX structure, but I do. So I have no idea why creating source voice function fails.   If you have any thoughts about that I would be really happy to hear them.   Here is the code of my whole program code: #include <fstream> #include <iostream> #include <xaudio2.h> #include <vorbis\codec.h> #include <vorbis\vorbisfile.h> #pragma comment(lib, "xaudio2.lib") #pragma comment(lib, "libvorbisfile.lib") using namespace std; int main() { //Ogg vorbis file// <---- This is the booring part of the program you can skip this code OggVorbis_File file; vorbis_info* fileInfo; vorbis_comment* fileComment; int* bitstream = 0; ov_fopen("1.ogg", &file); fileInfo = ov_info(&file, -1); fileComment = ov_comment(&file, -1); char* buf = new char[2048]; ov_read(&file, buf, 2048, 0, 2, 1, bitstream); cout << "BitTrack - " << file.bittrack << "\nCurrent link - " << file.current_link << "\nCurrent serial number - " << file.current_serialno << "\nData offsets - " << file.dataoffsets << "\nEng - " << file.end << "\nLinks - " << file.links << "\nOffset - " << file.offset << "\nPCM Lengths - " << file.pcmlengths << "\nPCM Offset - " << file.pcm_offset << "\nReady state - " << file.ready_state << "\nSamptrack - " << file.samptrack << "\nSeekable - " << file.seekable << "\nSerial numbers - " << file.serialnos; cout << "\n\nBitrate lower - " << fileInfo->bitrate_lower << "\nBitrate nominal - " << fileInfo->bitrate_nominal << "\nBitrate upper - " << fileInfo->bitrate_upper << "\nBitrate window - " << fileInfo->bitrate_window << "\nChannels - " << fileInfo->channels << "\nRate - " << fileInfo->rate << "\nVersion - " << fileInfo->version; ofstream out("sound.txt"); for(ogg_int64_t i = 0; i < 2048; i++) { out << buf[i]; } out.close(); //XAudio2// <---- The place where the problematic code begins IXAudio2* engine; IXAudio2MasteringVoice* master; IXAudio2SourceVoice* source; WAVEFORMATEX wf; XAUDIO2_BUFFER buffer; ZeroMemory(&wf, sizeof(WAVEFORMATEX));// <---- As you can see I initialize and fill whole struct wf.wFormatTag = WAVE_FORMAT_PCM; wf.wBitsPerSample = file.bittrack; wf.nAvgBytesPerSec = fileInfo->bitrate_nominal;// <---- This bitrate is 4 times lower that *.wav wf.nChannels = fileInfo->channels; wf.nSamplesPerSec = fileInfo->rate; wf.nBlockAlign = (file.bittrack * fileInfo->channels) / 8; ZeroMemory(&buffer, sizeof(XAUDIO2_BUFFER)); buffer.AudioBytes = file.end; buffer.pAudioData = (BYTE*)buf; buffer.Flags = XAUDIO2_END_OF_STREAM; XAudio2Create(&engine); engine->CreateMasteringVoice(&master); engine->CreateSourceVoice(&source, &wf);// <---- Probably this is the place where the error occurs source->SubmitSourceBuffer(&buffer);// <---- Access violation happens here as source == 0(not initialized) source->Start(); system("pause"); return 0; } By the way checking the HRESULT says that engine->CreateSourceVoice(bla, bla, bla) is invalid... Invalid XAudio2 API call or arguments.
  8. Hello there,   I have a problem. I need my engine(that is written on top of direct2D) to support custom shaders. But as always microsoft samples are very scarce and impossible to understand. I've tried writting my own custom shader program, also tried to modify their only sample, but nothing worked..   That damned sample: http://code.msdn.microsoft.com/windowsapps/Direct2D-custom-image-7a1f2cb5/view/SourceCode#content   Has anyone used custom shaders in Direct2D and if Yes, could you provide me some samples on the matter? I would be very grateful.
  9. Hello there,   For 2 months I've been trying sfml, enet and other various networking libraries. But none of the mentioned networking programming tools(enet, SFML...) would work for me. I've tried shutting my firewall with open ports for both UDP and TCP connection, but nothing worked. I also tried several computers when trying this but with no success. I've been running PRECOMPILED samples that came with SDKs so they should be robust and stable.    So Is there any software that can show what is blocking my pc from connecting to other PCs?  PS. I have no router. When using local host all programs work perfectly. Games like CSS, ArmA 2, Fallen Earth can connect to their servers...   Well any suggestions would be appreciated. :D
  10. I've noticed that my computers have same IP address. Can it be the problem ? And more, UDP connection can send a message although it never reaches my other computer.
  11. Yes, at least the ones that you play in broswers...
  12. I'm running Windows 8.1 x64. And I dont have any experience on networking programming. I also dont know whether the problem is in connecting to other PCs or vice versa. So far I didnt succeed in running your suggested tools properly, but I'm gonna try them all if I have to.   And it would be great if you could send me working samples.
  13. Thanks for suggestion. Gonna try it right away...
  14. Found what was wrong... I had to intialize render target with specific pixel format... In my case that was D2D1::PixelFormat(DXGI_FORMAT_R8G8B8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED)   Hope this helps for people like me :D
  15. Hello there,   I'm wokring on a DEMO that uses both DirectX11 and Direct2D for rendering. However I got stuck trying to initialize render target. I simply can't initialize it. Could you help me solve this puzzle.   Here is the full code of the program: #include <Eagle2D.h> #include <d3d11_2.h> #include <d2d1_2.h> #include <DxErr.h> #include <iostream> using namespace std; #pragma comment (lib, "eagle2d.lib") #pragma comment (lib, "d3d11.lib") #pragma comment (lib, "d2d1.lib") using namespace Eagle2D; int main() { IE2DDevice* Device = CreateEagle2DDevice(); IE2DWindow* window = Device->CreateWindow(); ID3D11Device* device; ID3D11DeviceContext* deviceContext; IDXGISwapChain* swapChain; ID3D11RenderTargetView* backBuffer; IDXGIDevice* xDevice; IDXGISurface* xSurface; ID2D1Factory1* dFactory; ID2D1Device* dDevice; ID2D1DeviceContext* dDeviceContext; ID2D1RenderTarget* dRenderTarget; DXGI_SWAP_CHAIN_DESC scd; ZeroMemory(&scd, sizeof(DXGI_SWAP_CHAIN_DESC)); scd.BufferCount = 1; scd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; scd.BufferDesc.Width = window->GetSize().GetX(); scd.BufferDesc.Height = window->GetSize().GetY(); scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; scd.OutputWindow = window->_GetWin32HWND(); scd.SampleDesc.Count = 1; scd.Windowed = TRUE; scd.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH; D3D_FEATURE_LEVEL fl = D3D_FEATURE_LEVEL_10_0; D3D11CreateDeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, D3D11_CREATE_DEVICE_BGRA_SUPPORT, &fl, 1, D3D11_SDK_VERSION, &scd, &swapChain, &device, NULL, &deviceContext); device->QueryInterface(&xDevice); ID3D11Texture2D* pBackBuffer; swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&pBackBuffer); device->CreateRenderTargetView(pBackBuffer, NULL, &backBuffer); pBackBuffer->Release(); deviceContext->OMSetRenderTargets(1, &backBuffer, NULL); D3D11_VIEWPORT viewport; ZeroMemory(&viewport, sizeof(D3D11_VIEWPORT)); viewport.TopLeftX = 0; viewport.TopLeftY = 0; viewport.Width = window->GetSize().GetX(); viewport.Height = window->GetSize().GetY(); deviceContext->RSSetViewports(1, &viewport); //ID3D11Texture2D* buffer; swapChain->GetBuffer(0, __uuidof(IDXGISurface), (LPVOID*)&xSurface); //buffer->QueryInterface(&xSurface); D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &dFactory); dFactory->CreateDevice(xDevice, &dDevice); if(FAILED(dFactory->CreateDxgiSurfaceRenderTarget(xSurface, D2D1::RenderTargetProperties(D2D1_RENDER_TARGET_TYPE_HARDWARE, D2D1::PixelFormat(), 96, 96, D2D1_RENDER_TARGET_USAGE_NONE, D2D1_FEATURE_LEVEL_10), &dRenderTarget))) cout << "doh"; dDevice->CreateDeviceContext(D2D1_DEVICE_CONTEXT_OPTIONS_NONE, &dDeviceContext); while(Device->Run()) { dDeviceContext->BeginDraw(); dDeviceContext->Clear(D2D1::ColorF(0, 1, 0, 0.5)); dDeviceContext->EndDraw(); dRenderTarget->BeginDraw(); dRenderTarget->Clear(); dRenderTarget->EndDraw(); swapChain->Present(0, 0); } } //If you want to try this program, you will need to change Eagle2D window creation to win32 window.
  16. Hello everyone,   I'm currently learning to work with high-level game networking libraries. Problem is that I can't connect two computers. When I use local host( it works perfectly. I've tried disabling firewall and open ports, but that didn't make any good.    I've tried ENet, OpenPlay, and SFML libraries but they all can't connect. Please help !   OS: Windows 8.1 x64bit (I think the problem will be related to the OS as I hate it )
  17. Tank202

    Cannot connect two computers

    Well, I'm a bit confused. Do you need to bind server to some external IP? I thought that server uses IP of the host computer, and you need to use that when connecting.   Also SDK precompiled demos would have done this if that was so fundamental, but they didn't work either.   Finally, I prefer UDP, but I think I could do with TCP too, so in the mean time I'll try the TCP protocol. But still this question is very important to me, so if you have suggestions I would be very gratefull to hear them.   And I would also like to point out that I use C++.
  18. Hello,   I'm trying to incorporate my direct2D engine into c++/xaml metro app. I want to do this by using WICBitmap as render target. Unfortunately I dont know how to convert WICBitmap to BitmapImage or any other class that xaml would understand.   I know that microsoft released examples of connecting direct2D with xaml through Direct3D using DXGISurface, but that example is way out of my reach regarding my experiance level with metro apps.   So, how to display WICBitmap in c++/xaml metro app?
  19. Hello everyone,   I'm trying to incorporate my direct2D engine in direct3D app. Microsoft has snippets of how to make direct2D render on DXGISurface but that example is very incomplete and one must always guess what object types Microsoft is using.   The result is that when I try to get back buffer from swap chain the program stops working and I get no errors from DXErr functions. Later I noticed that swap chain pointer is NULL so I think the error occurs while creating swap chain or even earlier.   If you have an idea of whats happening that my program crashes, please let me know. I'll be very grateful.   Link of Microsoft example: http://msdn.microsoft.com/en-us/library/windows/desktop/dd370966(v=vs.85).aspx   My code according to example code: D3D10_FEATURE_LEVEL1 lvls[1] = { D3D10_FEATURE_LEVEL_10_0 }; IDXGIAdapter* adapter = 0; HRESULT hr = D3D10CreateDevice1(adapter, D3D10_DRIVER_TYPE_HARDWARE, NULL, NULL, D3D10_FEATURE_LEVEL_10_0, D3D10_1_SDK_VERSION, &device); if(FAILED(hr)) { MessageBox(0, DX::DXGetErrorDescription(hr), DX::DXGetErrorString(hr), MB_OK); } if(SUCCEEDED(hr)) { hr = device->QueryInterface(&device1); } if(SUCCEEDED(hr)) { hr = device->QueryInterface(&dxgiDevice); } if(SUCCEEDED(hr)) { hr = dxgiDevice->GetAdapter(&adapter); } if(SUCCEEDED(hr)) { hr = adapter->GetParent(IID_PPV_ARGS(&dxgiFactory)); if(FAILED(hr)) { MessageBox(0, DX::DXGetErrorDescription(hr), DX::DXGetErrorString(hr), MB_OK); } } if(SUCCEEDED(hr)) { DXGI_SWAP_CHAIN_DESC swapDesc; ::ZeroMemory(&swapDesc, sizeof(swapDesc)); swapDesc.BufferDesc.Width = Window->GetRect().GetSize()->GetX(); swapDesc.BufferDesc.Height = Window->GetRect().GetSize()->GetY();; swapDesc.BufferDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; swapDesc.BufferDesc.RefreshRate.Numerator = 60; swapDesc.BufferDesc.RefreshRate.Denominator = 1; swapDesc.SampleDesc.Count = 1; swapDesc.SampleDesc.Quality = 0; swapDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; swapDesc.BufferCount = 1; swapDesc.OutputWindow = Window->GetHWND(); swapDesc.Windowed = TRUE; hr = dxgiFactory->CreateSwapChain(device, &swapDesc, &swapChain); if(FAILED(hr)) { MessageBox(0, DX::DXGetErrorDescription(hr), DX::DXGetErrorString(hr), MB_OK); } } std::cout << swapChain << " " << surface << std::endl; hr = swapChain->GetBuffer(0, IID_PPV_ARGS(&surface)); if(FAILED(hr)) { MessageBox(0, DX::DXGetErrorDescription(hr), DX::DXGetErrorString(hr), MB_OK); } hr = D2D1CreateFactory((D2D1_FACTORY_TYPE)sdx.MultiThreaded, &factory); if(FAILED(hr)) { MessageBox(0, DX::DXGetErrorDescription(hr), DX::DXGetErrorString(hr), MB_OK); } Eagle2D::recti rc = Window->GetRect(); /*factory->CreateHwndRenderTarget( D2D1::RenderTargetProperties(), D2D1::HwndRenderTargetProperties(Window->GetHWND(), D2D1::SizeU(rc.GetSize()->GetX(), rc.GetSize()->GetY())), &rt);*/ float dpiX, dpiY; factory->GetDesktopDpi(&dpiX, &dpiY); D2D1_RENDER_TARGET_PROPERTIES props = D2D1::RenderTargetProperties( D2D1_RENDER_TARGET_TYPE_HARDWARE, D2D1::PixelFormat(DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_PREMULTIPLIED), dpiX, dpiY); hr = factory->CreateDxgiSurfaceRenderTarget(surface, props, &rt); if(FAILED(hr)) { MessageBox(0, DX::DXGetErrorDescription(hr), DX::DXGetErrorString(hr), MB_OK); } rt->CreateSolidColorBrush(Eagle2D::Color::DarkGrey._GetDirect2DColor(), &defBrush); private members of Direct2D class: ID2D1Factory* factory; ID2D1SolidColorBrush* defBrush; ID2D1RenderTarget* rt; IWICImagingFactory* imageFactory; ID3D10Device1* device; IDXGIFactory1* device1; IDXGISwapChain* swapChain; IDXGIDevice* dxgiDevice; IDXGIFactory* dxgiFactory; IDXGISurface* surface;
  20. Hi everyone,   I'm writing this specific motion blur shader where I have to pass 2 textures and some variables into the shader. The probem is that irrlicht engine console shows that it can't find my texture variables in the shader. Instead of texture variables it offers me to set samplers of those textures...   My previous shaders with one texture, pass it without problems, but now even if I pass textures from program to samplers in the shader, I get black screen(no output).   What can cause this?   I'm posting some code as it will describe the problem more clearly.   shader //Initialising part of the shader float4x4 WVP : WorldViewProjection; texture source; texture mapping; float2 move = float2(0, 0); float stepSize = 0.01; int samples = 10; sampler2D RSS = sampler_state { texture = <source>; addressU = CLAMP; addressV = CLAMP; minFilter = ANISOTROPIC; magFilter = ANISOTROPIC; }; sampler2D MAP = sampler_state { texture = <mapping>; addressU = CLAMP; addressV = CLAMP; minFilter = ANISOTROPIC; magFilter = ANISOTROPIC; }; class for passing variables //Shader callback for setting shader variables class IMotionBlurShaderCallback : public irr::video::IShaderConstantSetCallBack { public: IMotionBlurShaderCallback(irr::video::IVideoDriver* pDriver, float fStepSize = 0.001, int nSamples = 10) { driver = pDriver; move = std::auto_ptr<float>(new float[2]); stepSize = fStepSize; samples = nSamples; } virtual void OnSetConstants(irr::video::IMaterialRendererServices* services, irr::s32 userData) { WVP = driver->getTransform(irr::video::ETS_PROJECTION); WVP *= driver->getTransform(irr::video::ETS_VIEW); WVP *= driver->getTransform(irr::video::ETS_WORLD); services->setVertexShaderConstant("WVP", WVP.pointer(), 16); irr::s32 texture = 0; services->setPixelShaderConstant("source", &texture, 1); irr::s32 map = 1; services->setPixelShaderConstant("mapping", &map, 1); services->setPixelShaderConstant("move", move.get(), 2); services->setPixelShaderConstant("stepSize", &stepSize, 1); services->setPixelShaderConstant("samples", &samples, 1); } irr::video::IVideoDriver* driver; std::auto_ptr<float> move; irr::core::matrix4 WVP; float stepSize; int samples; };
  21. Hello,   I'm making real-geometry grass class for my engine and at the certain point I need to calculate spectators distance to each grass array. The problem is that when I implement standart c++ functions like sqrt and pow for the distance calculation the engine can render 10 times less grass than without it.   Is there any lightning fast c++ math library that can do basic square root and power functions ?   Thanks in advance :D
  22. Nice and clever opinions :D But the best solution is neither nice nor clever... Its simple - I've removed square root, where I couldn't extract rooting I implemented nVidia fastmath.h library(Kambiz post), and the best performance was achieved only by removing standart c++ cmath header and therefore removing all pow functions. Now the power calculations are hard-coded.   Maybe It doesn' say much but I'm quite happy with the result as the engine now can initialise up to 10mil grass blades, render (I think) up to 1mil in real-time. And the best part of it that it will be dramatically optimised in the meantime :P So i think the numbers will multiply and my game graphics will be rather detail and nice.   Thank you all for your time and effort :D
  23. Well I was thinking this way, but thought it wouldn't do any good. But now I'll try to do this thanks unless Kambiz pointed library will perform quite well :D
  24. Hello,   I have this very strange problem with XACT3. I'm trying to play a sound using SoundBank interface, but it seems that SoundBank object pointer after initialisation is NULL. When I run the program, it would not respond.   PS. Using WaveBank interface, the program runs just fine.   Please help me with this issue. I would be glad as hell    Here is the code:   //XACT3 stuff CoInitializeEx(NULL, COINITBASE_MULTITHREADED); IXACT3Engine* pXACT3Engine; XACT3CreateEngine(0, &pXACT3Engine); XACT_RUNTIME_PARAMETERS XACT3Parameters = {0}; XACT3Parameters.lookAheadTime = XACT_ENGINE_LOOKAHEAD_DEFAULT; pXACT3Engine->Initialize(&XACT3Parameters); IXACT3SoundBank* pSoundBank; HANDLE hMusicWaveBank = CreateFile("Music.xwb", GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); HANDLE hMusicSoundBank = CreateFile("MusicList.xsb", GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); pXACT3Engine->CreateInMemoryWaveBank(MapViewOfFile(CreateFileMapping(hMusicWaveBank, 0, PAGE_READONLY, NULL, GetFileSize(hMusicWaveBank, NULL), 0), FILE_MAP_READ, 0, 0, 0), GetFileSize(hMusicWaveBank, NULL), 0, 0, &pWaveBank); BYTE* pbMusicSoundBankBuffer = new BYTE[GetFileSize(hMusicSoundBank, NULL)]; pXACT3Engine->CreateSoundBank(pbMusicSoundBankBuffer, GetFileSize(hMusicSoundBank, NULL), 0, 0, &pSoundBank); //I've tried a lot of ways to get the first argument but nothing worked. IXACT3Cue* pCue; pSoundBank->Play(0, 0, 0, 0); //<- The point where the program stops responding //Win32 message loop while(GetMessage(&msg, hMainWindow, 0, 0) > 0) { TranslateMessage(&msg); DispatchMessage(&msg); pXACT3Engine->DoWork(); //Sleep(10); } pXACT3Engine->ShutDown();    
  25. Ok I've tried everything you suggested but nothing seems to help. However when I switch the creation flag to AUDITION_MODE it seems to initialise the SoundBank, but the program still won't play sounds using soundBank interface. Both of the cases the return value of  pXACT3Engine->Initialize(&XACT3Parameters); was S_OK.  Maybe it is the library problem as pXACT3Engine->CreateSoundBank function is declared in xact3.lib and I dont have it in my directX SDK library folders. And also when installing my directX SDK at the end I get the error that says something like S 1024 or 1028
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!