• Advertisement
Sign in to follow this  

[solved] [hlsl 10] SampleLevel( )'s location format?

This topic is 3963 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

either below is ok: uint3 foo = tex.SampleLevel(samp, float3(0, 0, 0), 0); uint3 foo = tex.SampleLevel(samp, float2(0, 0), 0); so SampleLevel has 3 parameters: (sampler s, float location, level L), as opposed to the 2 parameters: (sampler s, float location). //////////////////// Hi, in sdk, location is "float2 for a Texture2D", while "This function is similar to sample except that it uses the LOD level (in the last component of the location parameter) to choose the mipmap level. For example, a 2D texture uses the first two components for uv coordinates and the third component for the mipmap level." I don't know how to use it, anyway would "error X3088: SampleLevel method of object Texture2D does not take these arguments" now I have to walk around by Sample(), which is slower since mipmap. Any suggestions? thanks! [Edited by - yk_cadcg on May 13, 2007 11:45:14 PM]

Share this post

Link to post
Share on other sites
Thank you very much!
in my code, either line below gets error I mentioned:

uint3 foo = tex.SampleLevel(samp, float3(0, 0, 0));
uint3 foo = tex.SampleLevel(samp, float2(0, 0));


Texture2D <uint3> tex;
SamplerState samp
AddressU = Clamp;
AddressV = Clamp;

this samp is shared by all my textures of different formats. is it ok?
and tex-related codes outside the shader are:

ID3D10Texture2D* ptex = NULL;
descTex.Width = texW;
descTex.Height = texH;
descTex.MipLevels = 1;
descTex.ArraySize = 1;
descTex.Format = DXGI_FORMAT_R32G32B32_UINT;
descTex.SampleDesc.Count = 1;
descTex.SampleDesc.Quality = 0;
descTex.Usage = D3D10_USAGE_DYNAMIC;
descTex.BindFlags = D3D10_BIND_SHADER_RESOURCE;
descTex.CPUAccessFlags = D3D10_CPU_ACCESS_WRITE;
descTex.MiscFlags = 0;
V(g_pd3dDevice->CreateTexture2D(&descTex, NULL, &ptex));

Thank you very much!!!

btw, may I ask another question: how to read depth-buffer in ps? I seem to have heard that dx could read zbuffer.
Is it by use
ID3D10Texture2D* pTexDepth and ID3D10DepthStencilView, and in shader, just access it as texture? That seems weird, since I read the depth and meantime write it..
I can't
PS_OUTPUT ps(depth: SV_Depth)
it spits error for vs's lack of depth signature. Thanks!

Original post by jollyjeffers
What is your actual code for using SampleLevel()?


Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement