DXShaderCreate

Creates a shader of a specified type.

int  DXShaderCreate(
   int                  context,           // graphic context handle   
   ENUM_DX_SHADER_TYPE  shader_type,       // shader type 
   const string         source,            // shader source code
   const string         entry_point,       // entry point
   string&              compile_error      // string for receiving compiler messages
   );

Parameters

context

[in]  Handle for a graphic context created in DXContextCreate().

shader_type

[out]  The value from the ENUM_DX_SHADER_TYPE enumeration.

source

[in]  Shader source code in HLSL 5.

entry_point

[in]  Entry point – function name in a source code.

compile_error

[in]  String for receiving compilation errors.

Return Value

Handle for shader or INVALID_HANDLE in case of an error. To receive an error code, the GetLastError() function should be called.

Note

A created handle that is no longer in use should be explicitly released by the DXRelease() function.

ENUM_DX_SHADER_TYPE

ID

Value

Description

DX_SHADER_VERTEX

0

Vertex shader

DX_SHADER_GEOMETRY

1

Geometry shader

DX_SHADER_PIXEL

2

Pixel shader