• Content count

  • Joined

  • Last visited

Community Reputation

109 Neutral

About pikacc

  • Rank
  1. SlimDX or SharpDX ?

    I suggest to use either SharpDX or SlimDX + DirectX11 and take advantage of "feature sets", which allows you to use DirectX 11 API and run it on DX9 hardware when you use features only from DX9. Main advantage is DirectX 11 API which is much better than old DirectX9. You can also easily add optional features which takes advantage of DX 11 (tesselation, geometry shader, shader model 4, 5 etc...) and enable these features only when you detect DX10/11 hardware.
  2. Hi, I've got problem clearing shader resource array using effect interface. HLSL Code: [CODE] Texture2D Textures[3]; [/CODE] I'm using SlimDX, DirectX11. To access shader I'm using effect interface. Setting variable is OK, I just call: [CODE] EffectResourceVariable Textures = Effect.GetVariableByName("Textures"); Textures.SetResourceArray(args); [/CODE] But I can't clear the variable (I need it, because Texture is used also as render target, so it can't be bound to shader when rendering into it) I've tried: [CODE] Textures.SetResourceArray(new ShaderResourceView[] { null, null, null}, 0, 3); // throws NullReferenceException Textures.SetResourceArray(new ShaderResourceView[] { null, null, null}); // throws NullReferenceException Textures.SetResourceArray(null); // throws NullReferenceException Textures.SetResource(null); // clears only first texture (see PIX) [/CODE] Only functional way is: [CODE] Device.ImmediateContext.PixelShader.SetShaderResources(new ShaderResourceView[] { null, null, null }, 0 /* slot id */, 3 /* count */); [/CODE] but it's unsatisfactory, I don't want to use this interface and I can't be sure if variable is in slot 0 or not. When binding resource as Render target, and resource is also bind as shader resource, DX won't crash, but it's shown in PIX as warning, I want to get rid of this warnings. Also wan't to do things in DX right. If it's not possible, is there some quick workaround (for example clearing all PS resource slots?) Thank you. Andy PIX Warnings: [CODE] Message Render D3D11: WARNING: ID3D11DeviceContext::OMSetRenderTargets: Resource being set to OM RenderTarget slot 1 is still bound on input! [ STATE_SETTING WARNING #9: DEVICE_OMSETRENDERTARGETS_HAZARD ] Message Render D3D11: WARNING: ID3D11DeviceContext::OMSetRenderTargets[AndUnorderedAccessViews]: Forcing PS shader resource slot 1 to NULL. [ STATE_SETTING WARNING #7: DEVICE_PSSETSHADERRESOURCES_HAZARD ] [/CODE]