I'm encountering an issue in my Direct3D 9 application where horizontal lines appear at fixed 16-pixel intervals on a render target surface. Here's the setup:
Environment:
Direct3D 9, Windows, rendering to a texture render target.
Render Target:
Created with:
pD3DDevice->CreateTexture(width, height, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &pTextureImg, NULL)
then retrieved the surface with pTextureImg->GetSurfaceLevel(0, &pSurfaceImg). Dimensions are 1024x576.
Rendering:
Using DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, vertices, sizeof(Vertex)) to draw a textured quad (source texture has perfect edges) and a trailing effect (solid color quad with alpha blending).
Symptoms:
Horizontal lines appear every 16 pixels (64 bytes in A8R8G8B8) on pSurfaceImg, visible in saved PNGs (D3DXSaveSurfaceToFile).
Lines are faint, fixed in position, and only noticeable on previous frames when trailing is active (blending with alpha < 1).
The source texture (obj_img.texture) has no such artifacts.
Attempts:
- Changed blending:
SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE)for final output, TRUE for image rendering – resolved unwanted edge pixels but not the lines. - Adjusted vertex coordinates (from -0.5f offsets to exact 0 -> width/height) – no change.
- Tested
D3DFMT_X8R8G8B8instead ofA8R8G8B8– lines persist. - Tried
D3DPOOL_SYSTEMMEM– unsupported for render targets on my hardware. - Sampler settings:
D3DTADDRESS_CLAMP,D3DTEXF_LINEARfor all filters – no effect.
Suspicions:
Hardware tiling (16x16 pixel tiles) in D3DPOOL_DEFAULT amplified by trailing/blending.
Possible render target alignment or driver issue.
