TextureLoader.FillTexture(Texture,TextureShader) Method (Microsoft.DirectX.Direct3D)
Uses a user-provided function or a compiled high-level shader language (HLSL) function to fill each texel of each mip level of a given texture.
Definition
Visual Basic Public Shared Sub FillTexture( _
ByVal texture As Texture, _
ByVal textureShader As TextureShader _
)C# public static void FillTexture(
Texture texture,
TextureShader textureShader
);C++ public:
static void FillTexture(
Texture^ texture,
TextureShader^ textureShader
);JScript public static function FillTexture(
texture : Texture,
textureShader : TextureShader
);
Parameters
texture Microsoft.DirectX.Direct3D.Texture
A Texture object that represents the filled texture.textureShader Microsoft.DirectX.Direct3D.TextureShader
A TextureShader object that contains the compiled HLSL function. This can be created using ShaderLoader.CompileShader, ShaderLoader.CompileShaderFromStream, or ShaderLoader.CompileShaderFromFile.
Remarks
If the param_GraphicsStream_compiledCode parameter is used, the HLSL function must contain the following semantics:
- One input parameter must use a POSITION semantic.
- One input parameter must use a PSIZE semantic.
- The function must return a parameter that uses the COLOR semantic.
The following is a C# code example of such an HLSL function:
[C#]float4 TextureGradientFill( float2 vTexCoord : POSITION, float2 vTexelSize : PSIZE) : COLOR { float r,g, b, xSq,ySq, a; xSq = 2.f*vTexCoord.x-1.f; xSq *= xSq; ySq = 2.f*vTexCoord.y-1.f; ySq *= ySq; a = sqrt(xSq+ySq); if (a > 1.0f) { a = 1.0f-(a-1.0f); } else if (a < 0.2f) { a = 0.2f; } r = 1-vTexCoord.x; g = 1-vTexCoord.y; b = vTexCoord.x; return float4(r, g, b, a); };
Note that the input parameters can be in any order, but both input semantics must be represented.
Exceptions
The method call is invalid. For example, a method's parameter might contain an invalid value.
This device does not support the queried technique.