Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

100 Neutral

About chenpan

  • Rank
  1. What should I do other than creating the rendertargetview? Reset the viewport? Or anything else? Thank you ~ Well, I just told you how to create that rendertargetview... [/quote]
  2. Thank you very much. Your code snippet helps a lot.
  3. uh, it works. I just think it's inconvenient. So I'm wondering if D3D10 support setting a level of a mipmap texture as render target. That will be very convenient.
  4. I'm using D3D10. I'm implementing a paper.
  5. Hey, I want to create a mipmap texture manually. Such that texel (i, j) of level n stores the minimum of texels (2i, 2j), (2i+1, 2j), (2i, 2j+1), (2i+1, 2j+1) in level n-1. Now I have level 0 of the mipmap texture. I want to fill texels data to the other levels using shader. Just like render to texture. I want to render to a level of a mipmap texture. Can I bind a level of a mipmap texture to the render target? How to do it? Thank you in advance!
  6. Texture2D<float4> g_Disparity; MipMapPSInput CopyTextureVS(StereoVSInput input) { MipMapPSInput output; float4 color = g_Disparity.Load(int3(input.pos.x, input.pos.y,0)); output.color = color.x; return output; } In PIX, when I debug the vertex shader. I got that variable color's value was ( 0.000, _, _, _ ). While the texel value in g_Disparity is (4.635, 0, 0, 0). How to get the texel value correctly? Thank you for your help~
  7. In vertex shader, I am trying to load texels' value in the way showing below. Texture2D<float4> g_Disparity; MipMapPSInput CopyTextureVS(StereoVSInput input) { MipMapPSInput output; uint width, height; g_Disparity.GetDimensions(width, height); output.pos.x = 2 * (float)input.pos.x / width - 1; output.pos.y = 1 - 2 * (float)input.pos.y / height; output.pos.z = 0.0f; output.pos.w = 1.0f; float4 color = g_Disparity.Load(int3(input.pos.x, input.pos.y,0)); output.color = color.x; return output; } In PIX, when I debug the vertex shader. After float4 color = g_Disparity.Load(int3(input.pos.x, input.pos.y,0)); executed . Variable color's value was ( 0.000, _, _, _ ) .While the value in texture g_Disparity is (4.635, 0,0, 0). How to get texel value correctly? Thank you for your help.
  8. I'm sorry. It's still hard for me to disable G,B and A writting using BlendState. My code snippet is showing bellow. BlendState RenderRedOnly { BlendEnable[0] = TRUE; RenderTargetWriteMask[0] = 0x01; }; float MipMapPS(MipMapPSInput input):SV_Target { return input.color; } technique10 tech { pass P0 { SetBlendState(RenderRedOnly, float4(0.0f, 0.0f, 0.0f, 0.0f), 0xffffffff); SetPixelShader(CompileShader(ps_4_0, MipMapPS())); .................. } } float clearcolor[] = {0.0f, 0.0f, 0.0f, 0.0f}; pdevice->ClearRenderTargetView(MipMapRTV, clearcolor); The pixel shader return a color value which may be bigger than 1. Will it be clipped to the range of [0,1]? Thank you very much!
  9. How to disable B,G,A channels? If one texture is set as a render target, can its Format be any other than DXGI_FORMAT_R32G32B32A32_FLOAT?
  10. I have a ID3D10Texture2D object (A) with the format DXGI_FORMAT_R32_FLOAT and another ID3D10Texture2D object (B) with the format DXGI_FORMAT_R32G32B32A32_FLOAT. Now I want to copy texture B's red channel to texture A. How to do it in Directx10. Are there any api functions to deal with it? Thx~
  11. I want to render the scene to a texture. And later use it as shader resource. So I create a Render Target View of the texture. And set it as the render target. I am wondering that can the texture's Format be DXGI_FORMAT_R32_FLOAT? Must the texture's Format be DXGI_FORMAT_R32G32B32A32_FLOAT? Thank u very much!
  12. First I create a vertex buffer. for(int y = 0; y < 480; y++) { for (int x = 0; x < 640; x++) { pix[y * 640 + x].pos[0] = x; pix[y * 640 + x].pos[1] = y; } } vbd.Usage = D3D10_USAGE_DEFAULT; vbd.CPUAccessFlags = 0; vbd.ByteWidth = sizeof(point) * 307200; vbd.BindFlags = D3D10_BIND_VERTEX_BUFFER; D3D10_SUBRESOURCE_DATA vinitData2; vinitData2.pSysMem = pix; pdevice->CreateBuffer(&vbd, &vinitData2, &g_pStereoBuffer); UINT stride = sizeof(point); UINT offset = 0; pdevice->IASetVertexBuffers(0, 1, &g_pStereoBuffer, &stride, &offset); //Then, I try to Load texel value according to vertices in the vertex buffer. DisparityPSInput CalDisparityVS(StereoVSInput input) { DisparityPSInput output; uint width,height; g_depth.GetDimensions(width, height); float d = g_depth.Load(int3(input.pos.x, input.pos.y, 0)); ................................ } i and j Values are changed properly.
  13. Hi, everyone. I'm trying to load a texel of 2D texture in HLSL. The values in the texture is in the range of (0.997,1.0). But when I load the texels' value in the following way. I got all values 1.0. So where is the problem? Thank you in advance. Texture2D<float> texture; float value = texture.Load(int3(i, j, 0));//the texel's value is less than 1, but the result is value = 1 here. Why?
  14. Using REF device, I get the same result in PIX as in VS2008. But why? In addition to that, try using the REF device in your application and see if you get the exact same result as the hardware device. If not, then it is likely that mhagain's suggestion is right - the driver is allowing slightly more sloppy usage than the spec indicates. [/quote]
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!