Sign in to follow this  
_Flame_

DX11 DX11 software mode.

Recommended Posts

_Flame_    112
Hi.
Is it possible to run DX11 application in software mode on Win7? I've tried but i've had an error "incorrect parameter". I know that i need to put handle of module as one of parameters and i did it but it's not a handle where a window is. Is it ok? Could anyone help me? Maybe anyone has an example? Thanks.

Share this post


Link to post
Share on other sites
MJP    19754
For software mode you're supposed to provide a handle to a DLL that implements a D3D11 driver + rasterizer in software. If you don't have one, you can't use it.

There is a built-in software rasterizer, called [url="http://msdn.microsoft.com/en-us/library/gg615082.aspx"]WARP[/url]. To you use it you pass D3D_DRIVER_TYPE_WARP when creating the device.

Share this post


Link to post
Share on other sites
_Flame_    112
Thanks for answer. So as i understand correctly i need to provide a handle of my main application but not a handle of dll where my engine is? And after that it will work in software mode well? Ok, i will try. Just another question. What's the difference between software and reference mode? And what do you mean "built-in software rasterizer, called WARP". I've heard a little bit about that mode and i've thought that it's software mode which works a little bit faster when usual software mode and i don't know why. But the problem is that only DX10.1 is available on Win7 with that mode and it's not suitable for me.

Share this post


Link to post
Share on other sites
mhagain    13430
[quote name='_Flame_' timestamp='1342070397' post='4958258']
But the problem is that only DX10.1 is available on Win7 with that mode and it's not suitable for me.
[/quote]
I'm not sure where you heard that, but you heard wrong. Full D3D11 is available on Windows 7. Even if you have downlevel hardware you can still use feature levels to target it with the D3D11 API - http://msdn.microsoft.com/en-us/library/windows/desktop/ff476876%28v=vs.85%29.aspx

Share this post


Link to post
Share on other sites
_Flame1_    99
It's me again but under abit different nickname coz i don't have pass here from my original nickname [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]

I've read about those limitations here - [url="http://msdn.microsoft.com/en-us/library/windows/desktop/ff476328%28v=vs.85%29.aspx"]http://msdn.microsof...8(v=vs.85).aspx[/url]

[quote]A WARP driver, which is a high-performance software rasterizer. The rasterizer supports feature levels 9_1 through level 10_1 with a high performance software implementation
[b]Note[/b] The WARP driver that Windows 8 includes supports feature levels 9_1 through level 11_1.[/quote]

But anyway i'm not successfull in the any software modes now. My app is .net. And i do such thing - GetModuleHandle("MayApp.vcshost.exe"); and this function retuns handle which isn't null but i again have error - "Incorrect parameter" in the function [font=monospace]D3D11CreateDivice. [/font]What's wrong? Edited by _Flame1_

Share this post


Link to post
Share on other sites
Nik02    4348
The handle is expected to be that of a native module (commonly a dll), which implements and exports the D3D driver entrypoints (there are lot of them).

All the stuff you need to implement is listed in the Windows DDK under the graphics drivers section. The basics of implementing a software driver are almost exactly same as implementing the user-mode portion of a hardware driver, though direct kernel access is not strictly necessary in pure software. In addition, software driver necessarily needs to implement the actual drawing operations such as the whole graphics pipeline, which would otherwise reside on GPU hardware.

I am under the impression that D3D 11.1 will be released on Vista and 7 as well, after '8' launches. This would enable you to use the WARP driver with 11.0 feature set. Edited by Nik02

Share this post


Link to post
Share on other sites
_Flame1_    99
Very funny Nik02. I need to implement a software driver for that.

[quote]A reference driver, which is a software implementation that supports every Direct3D feature. A reference driver is designed for accuracy rather than speed and as a result is slow but accurate. The rasterizer portion of the driver does make use of special CPU instructions whenever it can, but it is not intended for retail applications; use it only for feature testing, demonstration of functionality, debugging, or verifying bugs in other drivers. This driver is installed by the DirectX SDK. This driver may be referred to as a REF driver, a reference driver or a reference rasterizer.[/quote]

Where can i get that driver? [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]
I see that DX runtime has D3D11Ref.dll. What's that? Edited by _Flame1_

Share this post


Link to post
Share on other sites
_Flame1_    99
Guys why are you decreasing my reputation? I just need to use software mode for my application, no more. [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] Is it problem? Edited by _Flame1_

Share this post


Link to post
Share on other sites
Hodgman    51231
[quote name='_Flame_' timestamp='1342039817' post='4958157']
I know that i need to put handle of module as one of parameters and i did it but it's not a handle where a window is. Is it ok?
[/quote][quote name='MJP' timestamp='1342041509' post='4958168']
For software mode you're supposed to provide a handle to a DLL that implements a D3D11 driver + rasterizer in software. If you don't have one, you can't use it.
[/quote][quote name='_Flame_' timestamp='1342070397' post='4958258']
So as i understand correctly i need to provide a handle of my main application but not a handle of dll where my engine is?
I do such thing - GetModuleHandle("MayApp.vcshost.exe"); and this function retuns handle which isn't null but i again have error - "Incorrect parameter" in the function D3D11CreateDivice. What's wrong?
[/quote][quote name='Nik02' timestamp='1342096354' post='4958374']
The handle is expected to be that of a native module (commonly a dll), which implements and exports the D3D driver entrypoints (there are lot of them).
[/quote][quote name='_Flame1_' timestamp='1342100958' post='4958397']
Very funny Nik02. I need to implement a software driver for that.
[/quote]You asked about your incorrect use of the handle parameter... MJP told you that this parameter is supposed to be used to load a custom D3D Driver DLL ([i]and tried to steer you away from this and onto the WARP software driver[/i])... You ignored him and kept trying to pass a handle to your application as if it were a software D3D driver... Nik02 again explained that the handle is for a driver DLL, and if you want to use it, you must implement this DLL yourself... and then you treat his reply as a joke, and tell him what they both told you already?? I dont understand how you're simultaneously understanding their advice and ignoring their advice!

You can either
* load a software driver DLL (which you can write yourself, in theory...),
* use WARP with it's feature level restrictions, or
* use the reference device, although it's supposed to only be used for debugging purposes. Edited by Hodgman

Share this post


Link to post
Share on other sites
_Flame1_    99
Dear Hodgman i don't know this topic and it's easy for me not to understand correctly. They said that i need to put a handle where driver is. But i thought that it's in my application. Ok. it was a mistake, now i've got it. I've ask some example or maybe small piece of code. Advice about implementing a driver is really joke for me. [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] I didn't ask that at all. All i need is to run my application in software mode. What should i do for that? I don't need abstract advice i need practical. [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]

[quote]
You can either
* load a software driver DLL (which you can write yourself, in theory...),
* use WARP with it's feature level restrictions, or
* use the reference device, although it's supposed to only be used for debugging purposes.
[/quote]

1. I can't do the first one.
2. How?
3. How?

What the hell should i do for 2 and 3 options? Edited by _Flame1_

Share this post


Link to post
Share on other sites
mhagain    13430
For WARP you just specify D3D_DRIVER_TYPE_WARP in your D3D11CreateDeviceAndSwapChain call. That's all documented in the SDK.

As I flagged above, be very very certain that you do in fact need a software device before jumping in and creating one. You indicated that your understanding was that Windows 7 doesn't support D3D11 but that understanding is wrong. Even if you do need to run a program on downlevel (i.e. D3D9 or 10 class) hardware you can still do so via feature levels - check the link I provided above.

So it's likely that you don't in fact need a software device at all.

Share this post


Link to post
Share on other sites
_Flame1_    99
[quote]For WARP you just specify D3D_DRIVER_TYPE_WARP in your D3D11CreateDeviceAndSwapChain call. That's all documented in the SDK.[/quote]
I use D3D11CreateDevice and this flag doesn't work for me. I've tried all software flags(ref, warp and soft) and no one works. I've got an error "incorrect parameter".

[quote]As I flagged above, be very very certain that you do in fact need a software device before jumping in and creating one. You indicated that your understanding was that Windows 7 doesn't support D3D11 but that understanding is wrong. Even if you do need to run a program on downlevel (i.e. D3D9 or 10 class) hardware you can still do so via feature levels - check the link I provided above.[/quote]
No, you didn't understand me. I wrote that WARP doesn't have DX11 if i correctly understand msdn.

Share this post


Link to post
Share on other sites
Nik02    4348
What are the exact features present in the 11.0 profile that you can't live without?

Functionality equivalent to tessellation and compute shaders is fairly trivial to implement in software, even though the rest of the drawing would happen in actual GPU hardware (even legacy GPUs). Of course, software is always going to be slower at these, and neither WARP nor your theoretical custom sw driver won't change that.

And, as I said previously, the newest version of WARP does support the D3D11 feature set. You just have to wait until the 11.1 runtime is released later this year. If you can't really wait, the only way is to write your own driver - which couldn't be farther from trivial, but is possible for an experienced software engineer team with a lot of time on their hands. Writing the driver from scratch very likely takes more time than waiting for the new WARP driver, though; no matter how experienced the team is. Edited by Nik02

Share this post


Link to post
Share on other sites
_Flame_    112
Nick02 why are you teaching me what i need and what i don't need. I've already said what i need. If it's impossible now then ok i will cope with it. I don't care about performance at all. The only thing that i need is DX11 software mode to run my app without appropriate hardware, no more.

Share this post


Link to post
Share on other sites
mhagain    13430
The thing is, you've already been told that you can run your app without appropriate hardware.

You don't need a software mode for this.
You can still use the D3D11 API.

Just use [url="http://msdn.microsoft.com/en-us/library/windows/desktop/ff476876%28v=vs.85%29.aspx"]feature levels[/url] and it will work. If you must, you can go so far as to specify D3D_FEATURE_LEVEL_9_1 and it will even work on ancient D3D9 class hardware. So unless there are specific features that only D3D11 has and that you must use, which was Nick02's question, you already have an appropriate solution that does not require a software mode.

Share this post


Link to post
Share on other sites
_Flame_    112
mhagain. I know that i can use DX11 with profiles. It's not a secrect for me. I need a software mode with full featured DX11 profile. Again, you advice me that i don't need. It seem to me that this discussion is useless for me. It's better to close that topic if it goes that way. For some reason you just like decreasing reputation instead of real help.

Share this post


Link to post
Share on other sites
Nik02    4348
We tried to be helpful and offer alternative ways to proceed, but it seems that the effort was wasted.

I know that MJP, mhagain and Hodgman are experienced software developers as well as helpful guys in general; we generally know what we're doing and we try to reply with our best knowledge. Usually, if you hit a dead end, the wise way to proceed is to find alternative ways. We presented several such ways, all of which are viable (though with hugely varying amount of effort required) but you insist on clawing your way through the thick brick wall that blocks your path.

If we had more accurate information about the scenario you actually want to accomplish, we would be able to offer more accurate help. But, personally, I don't have any incentive left to do that. I'll just concentrate on helping those that appreciate the effort.

Bye,
-N

Share this post


Link to post
Share on other sites
Erik Rufelt    5901
[quote name='_Flame_' timestamp='1342207571' post='4958880']
I don't care about performance at all. The only thing that i need is DX11 software mode to run my app without appropriate hardware, no more.
[/quote]

D3D_DRIVER_TYPE_REFERENCE is exactly that, as others have already suggested. It has all full D3D11 features.

Share this post


Link to post
Share on other sites
Bacterius    13165
Flame, do you have the DirectX SDK installed? Debug, Reference [s]and WARP[/s] drivers are [i]only[/i] available from the SDK - since they are supposed to be debug tools. Edited by Bacterius

Share this post


Link to post
Share on other sites
Bacterius    13165
[quote name='MJP' timestamp='1342402740' post='4959413']
WARP isn't a debugging tool, it's intended to be deployed. So I'm pretty sure you don't need to install the SDK to use it.
[/quote]
Indeed [url="http://msdn.microsoft.com/en-us/library/windows/desktop/gg615082%28v=vs.85%29.aspx#how_to_use_warp"]it is part of the D3D runtime[/url] - my mistake. Thanks MJP.

Share this post


Link to post
Share on other sites
_Flame1_    99
Yes. It's not good if it will be nessesary to install DirectX SDK but it's alright.
Ok, here is my code.

[code]D3D_DRIVER_TYPE driver = D3D_DRIVER_TYPE_REFERENCE;
D3D11CreateDevice(pAdapter, driver, 0, 0, 0, 0, D3D11_SDK_VERSION, &pDevice, NULL, NULL );[/code]

Also i've tried D3D_DRIVER_TYPE_WARP. And i have HRESULT - 0x80070057(The parameter is incorrect. ) all time.
Yes, i have installed latest DirectX Sdk.

Share this post


Link to post
Share on other sites
Hodgman    51231
Maybe you need the other 2 [font=courier new,courier,monospace]out[/font] params to not be [font=courier new,courier,monospace]NULL[/font]?[code]D3D_FEATURE_LEVEL level = 0;
ID3D11DeviceContext* pContext = 0;
D3D_DRIVER_TYPE driver = D3D_DRIVER_TYPE_REFERENCE;
D3D11CreateDevice(pAdapter, driver, 0, 0, 0, 0, D3D11_SDK_VERSION, &pDevice, &level, &pContext );[/code]
[Edit] Also, did you see this restriction? It implies that [font=courier new,courier,monospace]pAdapter[/font] should be [font=courier new,courier,monospace]NULL[/font] for a reference driver.
[quote]If you set the pAdapter parameter to a non-NULL value, you must also set the DriverType parameter to the D3D_DRIVER_TYPE_UNKNOWN value.[/quote] Edited by Hodgman

Share this post


Link to post
Share on other sites
_Flame1_    99
Thanks. D3D_DRIVER_TYPE_REFERENCE is working now with NULL adapter.

But i can't create swap chain now.
The function CreateSwapChain returns error - 0x887A0001(DXGI_ERROR_INVALID_CALL).


Also i can't run my application with WARP.
[code]D3D_DRIVER_TYPE driver = D3D_DRIVER_TYPE_WARP;
D3D11CreateDevice(0, driver, 0, 0, 0, 0, D3D10_SDK_VERSION, &pDevice, NULL, NULL );[/code]
I have an error "The parameter is incorrect" again. Edited by _Flame1_

Share this post


Link to post
Share on other sites
_Flame1_    99
Any ideas? Firstly i invoke D3D11CreateDevice and secondly IDXGIFactory->CreateSwapChain;

My SwapChainDescription is quite simple.

[code]DXGI_SWAP_CHAIN_DESC sd;
ZeroMemory( &sd, sizeof( sd ) );
sd.BufferCount = 1;
sd.BufferDesc.Width = 640;
sd.BufferDesc.Height = 480;
sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
sd.BufferDesc.RefreshRate.Numerator = 60;
sd.BufferDesc.RefreshRate.Denominator = 1;
sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
sd.OutputWindow = g_hWnd;
sd.SampleDesc.Count = 1;
sd.SampleDesc.Quality = 0;
sd.Windowed = TRUE;[/code]

I took it from msdn example.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Similar Content

    • By isu diss
       I'm trying to code Rayleigh part of Nishita's model (Display Method of the Sky Color Taking into Account Multiple Scattering). I get black screen no colors. Can anyone find the issue for me?
       
      #define InnerRadius 6320000 #define OutterRadius 6420000 #define PI 3.141592653 #define Isteps 20 #define Ksteps 10 static float3 RayleighCoeffs = float3(6.55e-6, 1.73e-5, 2.30e-5); RWTexture2D<float4> SkyColors : register (u0); cbuffer CSCONSTANTBUF : register( b0 ) { float fHeight; float3 vSunDir; } float Density(float Height) { return exp(-Height/8340); } float RaySphereIntersection(float3 RayOrigin, float3 RayDirection, float3 SphereOrigin, float Radius) { float t1, t0; float3 L = SphereOrigin - RayOrigin; float tCA = dot(L, RayDirection); if (tCA < 0) return -1; float lenL = length(L); float D2 = (lenL*lenL) - (tCA*tCA); float Radius2 = (Radius*Radius); if (D2<=Radius2) { float tHC = sqrt(Radius2 - D2); t0 = tCA-tHC; t1 = tCA+tHC; } else return -1; return t1; } float RayleighPhaseFunction(float cosTheta) { return ((3/(16*PI))*(1+cosTheta*cosTheta)); } float OpticalDepth(float3 StartPosition, float3 EndPosition) { float3 Direction = normalize(EndPosition - StartPosition); float RayLength = RaySphereIntersection(StartPosition, Direction, float3(0, 0, 0), OutterRadius); float SampleLength = RayLength / Isteps; float3 tmpPos = StartPosition + 0.5 * SampleLength * Direction; float tmp; for (int i=0; i<Isteps; i++) { tmp += Density(length(tmpPos)-InnerRadius); tmpPos += SampleLength * Direction; } return tmp*SampleLength; } static float fExposure = -2; float3 HDR( float3 LDR) { return 1.0f - exp( fExposure * LDR ); } [numthreads(32, 32, 1)] //disptach 8, 8, 1 it's 256 by 256 image void ComputeSky(uint3 DTID : SV_DispatchThreadID) { float X = ((2 * DTID.x) / 255) - 1; float Y = 1 - ((2 * DTID.y) / 255); float r = sqrt(((X*X)+(Y*Y))); float Theta = r * (PI); float Phi = atan2(Y, X); static float3 Eye = float3(0, 10, 0); float ViewOD = 0, SunOD = 0, tmpDensity = 0; float3 Attenuation = 0, tmp = 0, Irgb = 0; //if (r<=1) { float3 ViewDir = normalize(float3(sin(Theta)*cos(Phi), cos(Theta),sin(Theta)*sin(Phi) )); float ViewRayLength = RaySphereIntersection(Eye, ViewDir, float3(0, 0, 0), OutterRadius); float SampleLength = ViewRayLength / Ksteps; //vSunDir = normalize(vSunDir); float cosTheta = dot(normalize(vSunDir), ViewDir); float3 tmpPos = Eye + 0.5 * SampleLength * ViewDir; for(int k=0; k<Ksteps; k++) { float SunRayLength = RaySphereIntersection(tmpPos, vSunDir, float3(0, 0, 0), OutterRadius); float3 TopAtmosphere = tmpPos + SunRayLength*vSunDir; ViewOD = OpticalDepth(Eye, tmpPos); SunOD = OpticalDepth(tmpPos, TopAtmosphere); tmpDensity = Density(length(tmpPos)-InnerRadius); Attenuation = exp(-RayleighCoeffs*(ViewOD+SunOD)); tmp += tmpDensity*Attenuation; tmpPos += SampleLength * ViewDir; } Irgb = RayleighCoeffs*RayleighPhaseFunction(cosTheta)*tmp*SampleLength; SkyColors[DTID.xy] = float4(Irgb, 1); } }  
    • By Endurion
      I have a gaming framework with an renderer interface. Those support DX8, DX9 and latest, DX11. Both DX8 and DX9 use fixed function pipeline, while DX11 obviously uses shaders. I've got most of the parts working fine, as in I can switch renderers and notice almost no difference. The most advanced features are 2 directional lights with a single texture  
      My last problem is lighting; albeit there's documentation on the D3D lighting model I still can't get the behaviour right. My mistake shows most prominently in the dark side opposite the lights. I'm pretty sure the ambient calculation is off, but that one's supposed to be the most simple one and should be hard to get wrong.
      Interestingly I've been searching high and low, and have yet to find a resource that shows how to build a HLSL shader where diffuse, ambient and specular are used together with material properties. I've got various shaders for all the variations I'm supporting. I stepped through the shader with the graphics debugger, but the calculation seems to do what I want. I'm just not sure the formula is correct.
      This one should suffice though, it's doing two directional lights, texture modulated with vertex color and a normal. Maybe someone can spot one (or more mistakes). And yes, this is in the vertex shader and I'm aware lighting will be as "bad" as in fixed function; that's my goal currently.
      // A constant buffer that stores the three basic column-major matrices for composing geometry. cbuffer ModelViewProjectionConstantBuffer : register(b0) { matrix model; matrix view; matrix projection; matrix ortho2d; }; struct DirectionLight { float3 Direction; float PaddingL1; float4 Ambient; float4 Diffuse; float4 Specular; }; cbuffer LightsConstantBuffer : register( b1 ) { float4 Ambient; float3 EyePos; float PaddingLC1; DirectionLight Light[8]; }; struct Material { float4 MaterialEmissive; float4 MaterialAmbient; float4 MaterialDiffuse; float4 MaterialSpecular; float MaterialSpecularPower; float3 MaterialPadding; }; cbuffer MaterialConstantBuffer : register( b2 ) { Material _Material; }; // Per-vertex data used as input to the vertex shader. struct VertexShaderInput { float3 pos : POSITION; float3 normal : NORMAL; float4 color : COLOR0; float2 tex : TEXCOORD0; }; // Per-pixel color data passed through the pixel shader. struct PixelShaderInput { float4 pos : SV_POSITION; float2 tex : TEXCOORD0; float4 color : COLOR0; }; // Simple shader to do vertex processing on the GPU. PixelShaderInput main(VertexShaderInput input) { PixelShaderInput output; float4 pos = float4( input.pos, 1.0f ); // Transform the vertex position into projected space. pos = mul(pos, model); pos = mul(pos, view); pos = mul(pos, projection); output.pos = pos; // pass texture coords output.tex = input.tex; // Calculate the normal vector against the world matrix only. //set required lighting vectors for interpolation float3 normal = mul( input.normal, ( float3x3 )model ); normal = normalize( normal ); float4 ambientEffect = Ambient; float4 diffuseEffect = float4( 0, 0, 0, 0 ); float4 specularEffect = float4( 0, 0, 0, 0 ); for ( int i = 0; i < 2; ++i ) { // Invert the light direction for calculations. float3 lightDir = -Light[i].Direction; float lightFactor = max( dot( lightDir, input.normal ), 0 ); ambientEffect += Light[i].Ambient * _Material.MaterialAmbient; diffuseEffect += saturate( Light[i].Diffuse * dot( normal, lightDir ) );// * _Material.MaterialDiffuse; //specularEffect += Light[i].Specular * dot( normal, halfangletolight ) * _Material.MaterialSpecularPower; } specularEffect *= _Material.MaterialSpecular; //ambientEffect.w = 1.0; ambientEffect = normalize( ambientEffect ); /* Ambient effect: (L1.ambient + L2.ambient) * object ambient color Diffuse effect: (L1.diffuse * Dot(VertexNormal, Light1.Direction) + L2.diffuse * Dot(VertexNormal, Light2.Direction)) * object diffuse color Specular effect: (L1.specular * Dot(VertexNormal, HalfAngleToLight1) * Object specular reflection power + L2.specular * Dot(VertexNormal, HalfAngleToLight2) * Object specular reflection power ) * object specular color Resulting color = Ambient effect + diffuse effect + specular effect*/ float4 totalFactor = ambientEffect + diffuseEffect + specularEffect; totalFactor.w = 1.0; output.color = input.color * totalFactor; return output; }   Edit: This message editor is driving me nuts (Arrrr!) - I don't write code in Word.
    • By Mercesa
      Hey folks. So I'm having this problem in which if my camera is close to a surface, the SSAO pass suddenly spikes up to around taking 16 milliseconds.
      When still looking towards the same surface, but less close. The framerate resolves itself and becomes regular again.
      This happens with ANY surface of my model, I am a bit clueless in regards to what could cause this. Any ideas?
      In attached image: y axis is time in ms, x axis is current frame. The dips in SSAO milliseconds are when I moved away from the surface, the peaks happen when I am very close to the surface.

       
      Edit: So I've done some more in-depth profiling with Nvidia nsight. So these are the facts from my results
      Count of command buffers goes from 4 (far away from surface) to ~20(close to surface).
      The command buffer duration in % goes from around ~30% to ~99%
      Sometimes the CPU duration takes up to 0.03 to 0.016 milliseconds per frame while comparatively usually it takes around 0.002 milliseconds.
      I am using a vertex shader which generates my full-screen quad and afterwards I do my SSAO calculations in my pixel shader, could this be a GPU driver bug? I'm a bit lost myself. It seems there could be a CPU/GPU resource stall. But why would the amount of command buffers be variable depending on distance from a surface?
       
       
      Edit n2: Any resolution above 720p starts to have this issue, and I am fairly certain my SSAO is not that performance heavy it would crap itself at a bit higher resolutions.
       
    • By turanszkij
      In DirectX 11 we have a 24 bit integer depth + 8bit stencil format for depth-stencil resources ( DXGI_FORMAT_D24_UNORM_S8_UINT ). However, in an AMD GPU documentation for consoles I have seen they mentioned, that internally this format is implemented as a 64 bit resource with 32 bits for depth (but just truncated for 24 bits) and 32 bits for stencil (truncated to 8 bits). AMD recommends using a 32 bit floating point depth buffer instead with 8 bit stencil which is this format: DXGI_FORMAT_D32_FLOAT_S8X24_UINT.
      Does anyone know why this is? What is the usual way of doing this, just follow the recommendation and use a 64 bit depthstencil? Are there performance considerations or is it just recommended to not waste memory? What about Nvidia and Intel, is using a 24 bit depthbuffer relevant on their hardware?
      Cheers!
       
    • By gsc
      Hi! I am trying to implement simple SSAO postprocess. The main source of my knowledge on this topic is that awesome tutorial.
      But unfortunately something doesn't work... And after a few long hours I need some help. Here is my hlsl shader:
      float3 randVec = _noise * 2.0f - 1.0f; // noise: vec: {[0;1], [0;1], 0} float3 tangent = normalize(randVec - normalVS * dot(randVec, normalVS)); float3 bitangent = cross(tangent, normalVS); float3x3 TBN = float3x3(tangent, bitangent, normalVS); float occlusion = 0.0; for (int i = 0; i < kernelSize; ++i) { float3 samplePos = samples[i].xyz; // samples: {[-1;1], [-1;1], [0;1]} samplePos = mul(samplePos, TBN); samplePos = positionVS.xyz + samplePos * ssaoRadius; float4 offset = float4(samplePos, 1.0f); offset = mul(offset, projectionMatrix); offset.xy /= offset.w; offset.y = -offset.y; offset.xy = offset.xy * 0.5f + 0.5f; float sampleDepth = tex_4.Sample(textureSampler, offset.xy).a; sampleDepth = vsPosFromDepth(sampleDepth, offset.xy).z; const float threshold = 0.025f; float rangeCheck = abs(positionVS.z - sampleDepth) < ssaoRadius ? 1.0 : 0.0; occlusion += (sampleDepth <= samplePos.z + threshold ? 1.0 : 0.0) * rangeCheck; } occlusion = saturate(1 - (occlusion / kernelSize)); And current result: http://imgur.com/UX2X1fc
      I will really appreciate for any advice!
  • Popular Now