Blender V4.3
draw_state.hh File Reference
#include "GPU_state.hh"
#include "BLI_utildefines.h"

Go to the source code of this file.

Namespaces

namespace  blender
 
namespace  blender::draw
 

Macros

#define DRW_STATE_DEFAULT    (DRW_STATE_WRITE_DEPTH | DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL)
 
#define DRW_STATE_BLEND_ENABLED
 
#define DRW_STATE_RASTERIZER_ENABLED
 
#define DRW_STATE_DEPTH_TEST_ENABLED
 
#define DRW_STATE_STENCIL_TEST_ENABLED    (DRW_STATE_STENCIL_ALWAYS | DRW_STATE_STENCIL_EQUAL | DRW_STATE_STENCIL_NEQUAL)
 
#define DRW_STATE_WRITE_STENCIL_ENABLED
 

Enumerations

enum  DRWState {
  DRW_STATE_NO_DRAW = 0 , DRW_STATE_WRITE_DEPTH = (1 << 0) , DRW_STATE_WRITE_COLOR = (1 << 1) , DRW_STATE_WRITE_STENCIL = (1 << 2) ,
  DRW_STATE_WRITE_STENCIL_SHADOW_PASS = (2 << 2) , DRW_STATE_WRITE_STENCIL_SHADOW_FAIL = (3 << 2) , DRW_STATE_DEPTH_ALWAYS = (1 << 4) , DRW_STATE_DEPTH_LESS = (2 << 4) ,
  DRW_STATE_DEPTH_LESS_EQUAL = (3 << 4) , DRW_STATE_DEPTH_EQUAL = (4 << 4) , DRW_STATE_DEPTH_GREATER = (5 << 4) , DRW_STATE_DEPTH_GREATER_EQUAL = (6 << 4) ,
  DRW_STATE_CULL_BACK = (1 << 7) , DRW_STATE_CULL_FRONT = (1 << 8) , DRW_STATE_STENCIL_ALWAYS = (1 << 9) , DRW_STATE_STENCIL_EQUAL = (2 << 9) ,
  DRW_STATE_STENCIL_NEQUAL = (3 << 9) , DRW_STATE_BLEND_ADD = (1 << 11) , DRW_STATE_BLEND_ADD_FULL = (2 << 11) , DRW_STATE_BLEND_ALPHA = (3 << 11) ,
  DRW_STATE_BLEND_ALPHA_PREMUL = (4 << 11) , DRW_STATE_BLEND_BACKGROUND = (5 << 11) , DRW_STATE_BLEND_OIT = (6 << 11) , DRW_STATE_BLEND_MUL = (7 << 11) ,
  DRW_STATE_BLEND_SUB = (8 << 11) , DRW_STATE_BLEND_CUSTOM = (9 << 11) , DRW_STATE_LOGIC_INVERT = (10 << 11) , DRW_STATE_BLEND_ALPHA_UNDER_PREMUL = (11 << 11) ,
  DRW_STATE_IN_FRONT_SELECT = (1 << 27) , DRW_STATE_SHADOW_OFFSET = (1 << 28) , DRW_STATE_CLIP_PLANES = (1 << 29) , DRW_STATE_FIRST_VERTEX_CONVENTION = (1 << 30) ,
  DRW_STATE_PROGRAM_POINT_SIZE = (1u << 31)
}
 

Functions

 ENUM_OPERATORS (DRWState, DRW_STATE_PROGRAM_POINT_SIZE)
 
DRWState to GPU state conversion
static eGPUWriteMask blender::draw::to_write_mask (DRWState state)
 
static eGPUFaceCullTest blender::draw::to_face_cull_test (DRWState state)
 
static eGPUDepthTest blender::draw::to_depth_test (DRWState state)
 
static eGPUStencilOp blender::draw::to_stencil_op (DRWState state)
 
static eGPUStencilTest blender::draw::to_stencil_test (DRWState state)
 
static eGPUBlend blender::draw::to_blend (DRWState state)
 
static eGPUProvokingVertex blender::draw::to_provoking_vertex (DRWState state)
 

Detailed Description

Internal Pipeline State tracking. It is higher level than GPU state as everything fits a single enum.

Definition in file draw_state.hh.

Macro Definition Documentation

◆ DRW_STATE_BLEND_ENABLED

#define DRW_STATE_BLEND_ENABLED
Value:

Definition at line 79 of file draw_state.hh.

Referenced by drw_state_set(), and blender::draw::to_blend().

◆ DRW_STATE_DEFAULT

◆ DRW_STATE_DEPTH_TEST_ENABLED

#define DRW_STATE_DEPTH_TEST_ENABLED

◆ DRW_STATE_RASTERIZER_ENABLED

#define DRW_STATE_RASTERIZER_ENABLED
Value:

Definition at line 83 of file draw_state.hh.

Referenced by drw_draw_pass_ex().

◆ DRW_STATE_STENCIL_TEST_ENABLED

◆ DRW_STATE_WRITE_STENCIL_ENABLED

Enumeration Type Documentation

◆ DRWState

enum DRWState

DRWState is a bit-mask that stores the current render state and the desired render state. Based on the differences the minimum state changes can be invoked to setup the desired render state.

The Write Stencil, Stencil test, Depth test and Blend state options are mutual exclusive therefore they aren't ordered as a bit mask.

Enumerator
DRW_STATE_NO_DRAW 

To be used for compute passes.

DRW_STATE_WRITE_DEPTH 

Write mask

DRW_STATE_WRITE_COLOR 
DRW_STATE_WRITE_STENCIL 
DRW_STATE_WRITE_STENCIL_SHADOW_PASS 
DRW_STATE_WRITE_STENCIL_SHADOW_FAIL 
DRW_STATE_DEPTH_ALWAYS 

Depth test. These options are mutual exclusive and packed into 3 bits

DRW_STATE_DEPTH_LESS 
DRW_STATE_DEPTH_LESS_EQUAL 
DRW_STATE_DEPTH_EQUAL 
DRW_STATE_DEPTH_GREATER 
DRW_STATE_DEPTH_GREATER_EQUAL 
DRW_STATE_CULL_BACK 

Culling test

DRW_STATE_CULL_FRONT 
DRW_STATE_STENCIL_ALWAYS 

Stencil test. These options are mutually exclusive and packed into 2 bits.

DRW_STATE_STENCIL_EQUAL 
DRW_STATE_STENCIL_NEQUAL 
DRW_STATE_BLEND_ADD 

Blend state. These options are mutual exclusive and packed into 4 bits

DRW_STATE_BLEND_ADD_FULL 

Same as additive but let alpha accumulate without pre-multiply.

DRW_STATE_BLEND_ALPHA 

Standard alpha blending.

DRW_STATE_BLEND_ALPHA_PREMUL 

Use that if color is already pre-multiply by alpha.

DRW_STATE_BLEND_BACKGROUND 
DRW_STATE_BLEND_OIT 
DRW_STATE_BLEND_MUL 
DRW_STATE_BLEND_SUB 
DRW_STATE_BLEND_CUSTOM 

Use dual source blending. WARNING: Only one color buffer allowed.

DRW_STATE_LOGIC_INVERT 
DRW_STATE_BLEND_ALPHA_UNDER_PREMUL 
DRW_STATE_IN_FRONT_SELECT 
DRW_STATE_SHADOW_OFFSET 
DRW_STATE_CLIP_PLANES 
DRW_STATE_FIRST_VERTEX_CONVENTION 
DRW_STATE_PROGRAM_POINT_SIZE 

DO NOT USE. Assumed always enabled. Only used internally.

Definition at line 25 of file draw_state.hh.

Function Documentation

◆ ENUM_OPERATORS()

ENUM_OPERATORS ( DRWState ,
DRW_STATE_PROGRAM_POINT_SIZE  )