• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

866 Good


About _void_

  • Rank

Personal Information

  • Interests
  1. @JoeJ Great :-) Thanks for the links!
  2. Hi guys, I am implementing parallel prefix sum on DirectCompute and using GPU Gems 3 article as a reference for CUDA implementation. In the article, the authors add logic to handle shared memory bank conflicts. Mark Harris, one of the authors, claimed later at Stack Overflow that you do not need to handle explicitly bank conflicts in CUDA any more. How about DirectCompute? Do you need to manage this yourself? Is there a difference between D3D10/D3D11/D3D12 versions? Thanks!
  3. OK. I see what you mean now
  4. @galop1n At the moment, I am not doing VSM pre-filtering yet but planning to add this. I did not understand. Why wouldn't SampleLevel work with VSM mip-maps?
  5. @galop1nYou are absolutely correct. SampleLevel fixes the problem. Thanks a bunch!
  6. Hi guys! I am using tile based shading in my project. I am adding shadows contribution to the shading pass and I am getting strange errors when compiling the pixel shader. Below is a code snippet of the pixel shader. float3 pointLightsContrib = float3(0.0f, 0.0f, 0.0f); for (uint lightIndexPerTile = pointLightIndexPerTileStart; lightIndexPerTile < pointLightIndexPerTileEnd; ++lightIndexPerTile) { uint lightIndex = g_PointLightIndexPerTileBuffer[lightIndexPerTile]; float3 lightWorldSpacePos = g_PointLightWorldBoundsBuffer[lightIndex].center; // Plus rest of the code float3 lightContrib = CalcPointLightContribution(lightWorldSpacePos, lightColor, lightRange, worldSpaceDirToViewer, worldSpacePos, worldSpaceNormal, diffuseAlbedo, specularAlbedo, shininess); // Plus rest of the code float lightVisibility = CalcPointLightVisibility(g_VarianceShadowMapSampler, g_PointLightTiledVarianceShadowMap, lightViewProjMatrix, lightViewNearPlane, lightRcpViewClipRange, worldSpacePos); pointLightsContrib += lightVisibility * lightContrib; } And there are helper functions used from the pixel shader above. float VSM(SamplerState shadowSampler, Texture2D<float2> varianceShadowMap, float2 shadowMapCoords, float receiverDepth) { float2 moments = varianceShadowMap.Sample(shadowSampler, shadowMapCoords).xy; return ChebyshevUpperBound(moments, receiverDepth); } float CalcPointLightVisibility(SamplerState shadowSampler, Texture2D<float2> varianceShadowMap, float4x4 lightViewProjMatrix, float lightViewNearPlane, float lightRcpViewClipRange, float3 worldSpacePos) { float4 lightClipSpacePos = mul(lightViewProjMatrix, float4(worldSpacePos, 1.0f)); float3 lightPostWDivideProjSpacePos = lightClipSpacePos.xyz / lightClipSpacePos.w; float2 shadowMapCoords = float2(0.5f * (lightPostWDivideProjSpacePos.x + 1.0f), 0.5f * (1.0f - lightPostWDivideProjSpacePos.y)); float lightSpaceDepth = lightClipSpacePos.w; float normalizedLightSpaceDepth = (lightSpaceDepth - lightViewNearPlane) * lightRcpViewClipRange; return VSM(shadowSampler, varianceShadowMap, shadowMapCoords, normalizedLightSpaceDepth); } When I compile the shader, I get the following warning and error. Warning: warning X3570: gradient instruction used in a loop with varying iteration, attempting to unroll the loop Error: error X3511: unable to unroll loop, loop does not appear to terminate in a timely manner (210 iterations) or unrolled loop is too large, use the [unroll(n)] attribute to force an exact higher number The warning points to the line "float2 moments = varianceShadowMap.Sample(shadowSampler, shadowMapCoords).xy;" of VSM function and the error points to the line "for (uint lightIndexPerTile = pointLightIndexPerTileStart; lightIndexPerTile < pointLightIndexPerTileEnd; ++lightIndexPerTile)". If I change implementation of VSM function to simply { return 1.0f } it compiles fine. What is going on?
  7. Hello! I am wondering if there is a way to find out how many resources you could bind to the command list directly without putting them in a descriptor table. Specifically, I am referring to these guys: - SetGraphicsRoot32BitConstant - SetGraphicsRoot32BitConstants - SetGraphicsRootConstantBufferView - SetGraphicsRootShaderResourceView - SetGraphicsRootUnorderedAccessView I remember from early presentations on D3D12 that the count of allowed resources is hardware dependent and quite small. But I would like to learn some more concrete figures.
  8. @SoldierOfLightThank you for the input! I do not feel I am compeletely following you on the following statememnt What do you specifically mean by "applicable" and "necessary"? Maybe you can give an example.
  9. Hello guys! My constant buffer view is used by geometry and pixel shaders but not vertex shader. What would a good practice in this case to setup constant buffer view visibility on the root signature? Is it really worth creating two separate root parameters with visibility D3D12_SHADER_VISIBILITY_GEOMETRY and D3D12_SHADER_VISIBILITY_PIXEL or maybe one root paramter with visiblity D3D12_SHADER_VISIBILITY_ALL will suffice? Is there a recommended way to set up root signature if the resource is visible to some shader stages but no all? Should you set it up for each stage or just make visible to all? Thanks!
  10. @ajmiles @SoldierOfLight Thank you guys! I guess, I managed to confuse everyone :-)
  11. Yeah, I can convert the texture to DXGI_FORMAT_R8G8B8A8_UNORM_SRGB format. I thought maybe there is a way to work this around using shader resource view, which I do not know about :-)
  12. Hello guys, I have a texture of format DXGI_FORMAT_B8G8R8A8_UNORM_SRGB. Is there a way to create shader resource view for the texture so that I could read it as RGBA from the shader instead of reading it specifically as BGRA? I would like all the textures to be read as RGBA. Tx
  • Advertisement