Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

118 Neutral

About Jmu

  • Rank

Personal Information

  • Interests

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Thanks again for your help. I've found a fix/workaround based on the following advice from the documentation here: https://docs.microsoft.com/en-us/windows/desktop/api/dxgi/nf-dxgi-idxgifactory-createswapchain So I now ensure that the swap chain is created in windowed mode, then set to full-screen via SetFullscreenState as a later step in the swap chain recreation function. This seems like a soft rule however, as setting the full-screen state in DXGI_SWAP_CHAIN_DESC does work for me under some conditions.
  2. Unfortunately this has not resolved the issue. I tried replacing the DXGI factory creation: DXGIFactory *pFactory = nullptr; CheckResult(CreateDXGIFactory(__uuidof(IDXGIFactory), reinterpret_cast<void **>(&pFactory))); With this access code: IDXGIDevice *pDXGIDevice = nullptr; IDXGIAdapter *pDXGIAdapter = nullptr; IDXGIFactory *pFactory = nullptr; impl.m_pDevice->QueryInterface(__uuidof(IDXGIDevice), reinterpret_cast<void **>(&pDXGIDevice)); pDXGIDevice->GetAdapter(&pDXGIAdapter); pDXGIAdapter->GetParent(__uuidof(IDXGIFactory), reinterpret_cast<void **>(&pFactory)); Thanks anyway! I'll continue to investigate CreateSwapChainDesc() and report back with whatever I find.
  3. Hi Aerodactyl55, thanks for your response. I'm continuing to investigate possible invalid parameters set in CreateSwapChainDesc(), but I'm interested in your second point. I'll try acquiring the IDXGIFactory through the device and report back.
  4. I should also add that I've gone through the best practices docs here: https://docs.microsoft.com/en-us/windows/desktop/direct3darticles/dxgi-best-practices In particular, I've made sure to specify DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH in DXGI_SWAP_CHAIN_DESC.Flags. The best practices docs do describe cases where DXGI may default to the desktop resolution despite the numbers supplied via DXGI_SWAP_CHAIN_DESC, which sounds pretty similar to what I'm seeing. Unfortunately though I can't see what rules I'm breaking.
  5. Hi everyone, here's a fun one. I've been using DX11 for ages and I've never seen anything like this happen before. I found a bug in an application I'm developing when changing the resolution in full-screen mode. In order to handle arbitrary display mode changes (such as changes to MSAA settings), I destroy and recreate the swap chain whenever the display mode changes (rather than just using IDXGISwapChain::ResizeBuffers and IDXGISwapChain::ResizeTarget). On application startup, the device and initial swapchain are created via D3D11CreateDeviceAndSwapChain. When the display mode changes, this initial swap chain is destroyed, and a new one is created using IDXGIFactory::CreateSwapChain, with a new DXGI_SWAP_CHAIN_DESC. What I've found is that, despite the new DXGI_SWAP_CHAIN_DESC being correct when supplied to IDXGIFactory::CreateSwapChain, if I then retrieve the desc from the resulting swap chain, it has values from the old one. For example, if the resolution is changed, the swap chain is created with new (correct) values for BufferDesc.Width and BufferDesc.Height, but this new swap chain contains the old values which the initial (now destroyed) swap chain desc had. Consequently the back buffer is the wrong size, which leads to obvious problems and errors. Has anyone encountered a similar situation, or can think of anything useful to investigate? Here's a simplified version of the code for the display mode change: m_pDeviceContext->ClearState(); m_pDeviceContext->OMSetRenderTargets(0, nullptr, nullptr); m_pSwapChain->Release(); m_pSwapChain = nullptr; IDXGIFactory *pFactory = nullptr; CheckResult(CreateDXGIFactory(__uuidof(IDXGIFactory), reinterpret_cast<void **>(&pFactory))); IDXGISwapChain *pSwapChain = nullptr; DXGI_SWAP_CHAIN_DESC swapChainDesc = CreateSwapChainDesc(...); // Returns populated DXGI_SWAP_CHAIN_DESC with correct values. CheckResult(pFactory->CreateSwapChain(impl.m_pDevice, &swapChainDesc, &pSwapChain)); DXGI_SWAP_CHAIN_DESC verifySwapChainDesc; ZeroMemory(&verifySwapChainDesc, sizeof(DXGI_SWAP_CHAIN_DESC)); pSwapChain->GetDesc(&verifySwapChainDesc); // swapChainDesc does not equal verifySwapChainDesc.
  6. Hello, I have recently begun using Cg and CgFX and have read through most of the Cg Tutorial book available at the nVidia Developer Zone. I am specifically interested in migrating an existing rendering effect system that uses Direct3D 9's .FX effect file format to Cg's .CgFX file format to increase portability, as CgFx is compatible with both Direct3D and OpenGL. CgFX seems well suited as according to the Cg Tutorial, it is "identical" to Direct3D 9's .FX file format. This is exactly what I need, as it will save me the effort of re-writing all of my effect scripts. Unfortunately, my effect scripts are not compiling under Cg, and I am beginning to doubt that .CgFX and .FX are identical. Consulting the documentation, there seem to be places where the DirectX convention is used, such as with the "CullMode" state, which accepts the DirectX enumerants "None", "CW", "CCW", and other times where some other convention is used, such as with the "DiffuseMaterialSource" state that only appears to accept the enumerants "true" and "false". (Whatever that means.) I am looking for a definitive answer: Should I expect to be able to compile under Cg any .FX script that compiles successfully under Direct3D 9? If so, what do I have to do to make this possible? Here is an example to illustrate the problem. My .CgFX effect, the contents of which compile successfuly as a DirectX .FX effect file under Direct3D 9:technique Default { pass P0 { Lighting = False; CullMode = None; AmbientMaterialSource = Color1; DiffuseMaterialSource = Color1; SpecularMaterialSource = Material; EmissiveMaterialSource = Material; LightEnable[0] = True; LightType[0] = Directional; LightDirection[0] = float3(0.0f, 1.0f, 0.0f); LightAmbient[0] = float4(0.1f, 0.1f, 0.1f, 1.0f); LightDiffuse[0] = float4(1.0f, 0.0f, 0.0f, 1.0f); LightSpecular[0] = float4(1.0f, 1.0f, 1.0f, 1.0f); MagFilter[0] = Linear; MinFilter[0] = Linear; MipFilter[0] = Linear; AddressU[0] = Clamp; AddressV[0] = Clamp; VertexShader = null; PixelShader = null; } } My set up code, which initializes Cg and loads the effect: CGcontext cgContext = cgCreateContext(); cgD3D9RegisterStates(cgContext); CGeffect cgEffect = cgCreateEffect(cgContext, "Data/Effects/Default.cgfx", nullptr); The errors that are reported when trying to compile the effect in the code above: error C1056: invalid initialization error C1008: undefined variable "Color1" error C1008: undefined variable "Color1" error C1008: undefined variable "Material" error C1008: undefined variable "Material" error C1008: undefined variable "Directional" error C1056: invalid initialization error C1008: undefined variable "Linear" error C1008: undefined variable "Linear" The Cg effect compiler is recognizing some of the Direct3D .FX script state enumerants, but not all of them. Why? I would greatly appreciate any help with this problem.
  • 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!