Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


#Actualunbird

Posted 15 April 2013 - 01:40 PM

Please apologize for giving bad advice earlier. You mentioning a TYPELESS format made me curious. I was wrong: One cannot sample from S/UInt formats, as it seems:

[6056] D3D11: ERROR: ID3D11DeviceContext::Draw: The Shader Resource View in slot 0 of the Pixel Shader unit is using the Format (R8_UINT). This format does not support 'Sample', 'SampleLevel', 'SampleBias' or 'SampleGrad', at least one of which may being used on the Resource by the shader. This mismatch is invalid if the shader actually uses the view (e.g. it is not skipped due to shader code branching). [ EXECUTION ERROR #371: DEVICE_DRAW_RESOURCE_FORMAT_SAMPLE_UNSUPPORTED ]

So, instead:
  • use a format you can sample from, e.g. a _FLOAT type. Oh, and by float division I meant ii / 256.0. You will get bad results with ii / 256 wink.png
  • Use Load instead of Sample and wrap manually.
Always make sure your normalization/indexing is sane: texture sampling uses normalized co-ordinates, Load uses texel, i.e. integer, co-ordinates.

Concerning wrapping. Either you wrap manually (your & 255), or you let the sampler do it. No need to do both. For Load, of course, you need to wrap manually. Alternatively - something I have seen in some Perlin implementation - is to use a bigger array (and duplicate the data) so you can save you the wrapping (Is this what you meant with the 512 wide texture ?).

#1unbird

Posted 15 April 2013 - 01:38 PM

Please apologize for giving bad advice earlier. You mentioning a TYPELESS format made me curious. I was wrong: One cannot sample from S/UInt formats, as it seems:

[6056] D3D11: ERROR: ID3D11DeviceContext::Draw: The Shader Resource View in slot 0 of the Pixel Shader unit is using the Format (R8_UINT). This format does not support 'Sample', 'SampleLevel', 'SampleBias' or 'SampleGrad', at least one of which may being used on the Resource by the shader. This mismatch is invalid if the shader actually uses the view (e.g. it is not skipped due to shader code branching). [ EXECUTION ERROR #371: DEVICE_DRAW_RESOURCE_FORMAT_SAMPLE_UNSUPPORTED ]

So, instead:
  • use a format you can sample from, e.g. a _FLOAT type. Oh, and by float division I meant ii / 256.0. You will get bad results with ii / 256 wink.png
  • Use Load instead of Sample and wrap manually.
Always make sure your normalization/indexing is sane: texture sampling uses normalized co-ordinates, Load uses texel, i.e. integer, co-ordinates.

Concerning wrapping. Either you wrap manually (your & 255), or you let the sampler do it. No need to do both. For Load, of course you need to wrap manually. Alternatively - something I have seen in some Perlin implementation - is to use a bigger array so you can save you the wrapping.

PARTNERS