Tank202

Members
  • Content count

    29
  • Joined

  • Last visited

Community Reputation

184 Neutral

About Tank202

  • Rank
    Member
  1. 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?
  2. Compute shader values

    Thanks for information. Looking forward to implement them.
  3. 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?
  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. OpenGL 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. OpenGL 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. 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.
  10. Yes, at least the ones that you play in broswers...
  11. 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.
  12. Thanks for suggestion. Gonna try it right away...
  13. 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
  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.