Asm 셰이더 참조

셰이더는 프로그래밍 가능한 그래픽 파이프라인을 구동합니다.

꼭짓점 셰이더 참조

꼭짓점 셰이더 차이점에서는 꼭짓점 셰이더 버전 간의 차이점을 요약 정리합니다.

픽셀 셰이더 참조

픽셀 셰이더 차이점에서는 픽셀 셰이더 버전 간의 차이점을 요약 정리합니다.

셰이더 모델 4 및 5 참조

셰이더 모델 4 어셈블리셰이더 모델 5 어셈블리 섹션에서는 셰이더 모델 4 및 5에서 지원하는 명령을 설명합니다.

어셈블리 셰이더의 상수 레지스터 동작

어셈블리 셰이더에서 상수 레지스터를 설정하는 방법에는 다음 두 가지가 있습니다.

  • def* 명령 중 하나를 사용하여 어셈블리 코드에서 셰이더 상수를 선언합니다.
  • Set***ShaderConstant* API 메서드 중 하나를 사용합니다.

Direct3D 9 셰이더 상수

Direct3D 9에서는 지정된 셰이더에서 정의된 상수의 수명이 해당 셰이더의 실행으로만 제한됩니다(재정의할 수 없음). Direct3D 9에서 정의된 상수는 셰이더 외부에서는 어떠한 부작용을 일으키지 않습니다.

Direct3D 9를 사용하는 예제는 다음과 같습니다.

Given: 
    Create shader1 which references c4 and defines it with the def instruction

Scenario 1:
    Call Set***Shader shader1
    Call Set***ShaderConstant* to set c4
    Call Draw
    Result: The shader will see the def'd value in c4

    
Given: 
    Scenario 1 has just completed
    Create shader2 (which references c4 but does not use the def instruction
      to define it) 

Scenario 2: 
    Call Set***Shader shader2
    Call Draw
    Result: The shader will see the value last set in c4 by 
     Set***ShaderConstant* in scenario 1. This is because shader 2 
     didn't def c4.

Direct3D 9에서 Get***ShaderConstant*를 호출하면 Set***ShaderConstant*를 통해 설정된 상수 값만 검색됩니다.

Direct3D 8 셰이더 상수

이 동작은 Direct3D 8.x에서 다릅니다.

Given:
    Create shader1 which references c4 and defines it with the def instruction

Scenario 1 (repeated with Direct3D 8):
    Call Set***Shader with shader1
    Call Set***ShaderConstant to set c4
    Call Draw
    Result: The shader will see the value in c4 from Set***ShaderConstant

Direct3D 8.x에서는 Set***ShaderConstant가 즉시 적용됩니다. 다음 시나리오를 고려해 보세요.

Given:
    Create shader1 which references c4 and defines it with the def instruction
    
Scenario 3:
    Call Set***Shader with shader1
    Call Draw
    Result: The shader will see the def'd value in c4

Given:
    Scenario 3 has just completed
    Create shader2 (which references c4 but does not use the def instruction 
      to define it)     
    
Scenario 4 :    
    Call Set***Shader with shader2
    Call Draw
    Result: The shader will see the def'd value in c4 (set by def in shader 1)

바람직하지 않은 결과는 셰이더가 설정된 순서가 개별 셰이더의 관찰된 동작에 영향을 줄 수 있다는 점입니다.

셰이더 드라이버 모델 요구 사항

Direct3D 9 인터페이스는 DirectX 7 수준 이상인 DDI(디바이스 드라이버 인터페이스) 드라이버로 제한됩니다. DDI 수준을 확인하려면 DirectX 진단 도구를 실행하고 저장된 텍스트 파일을 살펴봅니다.

참고로 Direct3D 8 인터페이스는 DirectX 6 수준 이상의 DDI 드라이버에서만 작동합니다.

셰이더 이진 형식

셰이더 명령 스트림의 비트 레이아웃은 D3d9types.h에서 정의됩니다. 셰이더 컴파일러 또는 생성 도구를 직접 디자인하고 셰이더 토큰 스트림에 대한 자세한 내용을 알아보려면 Direct3D 9 DDK(드라이버 개발 키트)를 참조하세요.

C와 유사한 셰이더 언어

C와 유사한 셰이더 언어를 경험하려면 HLSL 참조를 참조하세요.

HLSL에 대한 참조