CS/게임 프로그래밍

The Rendering Pipeline - Background

재호맴매 2024. 2. 4. 22:24

Pipeline State

Fixed-Function Pipeline Stage

  • Perform a set of fixed operations on the given data.
  • Use the status object to control the fixed-function pipeline stages.
  • The burden of validation of status setting API calls disappears.
  • The validation of the state occurs in the process of creating a state, not in the API call process at the time of execution.

 

Programmable Pipeline Stage

  • Programmable : can execute a program written in HLSL; High Level Shading Language.
  • Common shader core
    • Define general input and output designs.
    • Provide a set of intrinsic functions supported by all the sahder stages.
    • Provide the interface required for the shader program to use resources.

  • Shader core architecture
    • v# : receive input for shader core.
    • r#, x#[n] : can store data during the interim calculation process.
    • t#, cb#[n], icb[index], u# : provide access to various device memory resources.
    • o# : record the calculated values and deliver them to the next stage.

 

Pipeline Execution

Draw Method

// Type of draw method
Draw(...);
DrawAuto(...);
DrawIndexed(...);
DrawIndexedInstanced(...);
DrawInstanced(...);
DrawIndexedInstancedIndirect(...);
DrawInstancedIndirect(...);

 

Communication between Stages

  • Attribute : input / output data
  • Semantic (binding semantic) : text-based identifier given to input / output attributes
// A simple example of a declaration of a shader function
struct VS_INPUT
{
    float3 position : POSITION;
    float2 coords : TEXCOORDS;
    uint vertexID : SV_VertexID;
};

struct VS_OUTPUT
{
    float4 position : SV_POSITION;
    float4 color : COLOR;
};

VS_OUTPUT VSMAIN(in VS_INPUT v)
{
    // Vertex processing
}

float PSMAIN(in VS_OUTPUT input) : SV_Target
{
    // Pixel processing
}