11# define PIXELSIZE (U.pixelsize)
13# define PIXELSIZE (1.0f)
28#define SET_STATE(_prefix, _state, _value) \
30 StateManager *stack = Context::get()->state_manager; \
31 auto &state_object = stack->_prefix##state; \
32 state_object._state = (_value); \
35#define SET_IMMUTABLE_STATE(_state, _value) SET_STATE(, _state, _value)
36#define SET_MUTABLE_STATE(_state, _value) SET_STATE(mutable_, _state, _value)
102 uint32_t write_mask =
state.write_mask;
107 state.write_mask = write_mask;
114 uint32_t write_mask =
state.write_mask;
116 state.write_mask = write_mask;
139 state.write_mask = uint32_t(write_mask);
141 state.culling_test = uint32_t(culling_test);
142 state.depth_test = uint32_t(depth_test);
143 state.stencil_test = uint32_t(stencil_test);
144 state.stencil_op = uint32_t(stencil_op);
145 state.provoking_vert = uint32_t(provoking_vert);
177 state.point_size =
size * ((
state.point_size > 0.0) ? 1.0f : -1.0f);
195 int scissor_rect[4] = {
x,
y, width, height};
201 int viewport_rect[4] = {
x,
y, width, height};
241 return state.stencil_write_mask;
259 return state.line_width;
265 return bool(
state.line_smooth);
277 for (
int i = 0;
i < 4;
i++) {
278 coords[
i] = viewport[
i];
368 state.logic_op_xor =
false;
369 state.invert_facing =
false;
370 state.shadow_bias =
false;
371 state.clip_distances = 0;
372 state.clip_control =
false;
373 state.polygon_smooth =
false;
374 state.line_smooth =
false;
MINLINE float max_ff(float a, float b)
MINLINE void copy_v2_fl2(float v[2], float x, float y)
#define SET_FLAG_FROM_TEST(value, test, flag)
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
StateManager * state_manager
void viewport_set(const int viewport[4])
void scissor_set(const int scissor[4])
void scissor_test_set(bool test)
void scissor_get(int r_scissor[4]) const
void viewport_get(int r_viewport[4]) const
static GPUBackend * get()
virtual Fence * fence_alloc()=0
virtual void issue_barrier(GPUBarrier barrier_bits)=0
virtual void apply_state()=0
GPUStateMutable mutable_state
std::array< TextureWriteFormat, GPU_MAX_IMAGE > image_formats
void GPU_program_point_size(bool enable)
GPUStencilTest GPU_stencil_test_get()
void GPU_scissor_test(bool enable)
bool GPU_line_smooth_get()
void GPU_line_width(float width)
void GPU_provoking_vertex(GPUProvokingVertex vert)
void GPU_line_smooth(bool enable)
void GPU_logic_op_xor_set(bool enable)
void GPU_depth_mask(bool depth)
void GPU_face_culling(GPUFaceCullTest culling)
void GPU_blend(GPUBlend blend)
void GPU_stencil_write_mask_set(uint write_mask)
void GPU_depth_test(GPUDepthTest test)
void GPU_stencil_test(GPUStencilTest test)
bool GPU_mipmap_enabled()
void GPU_color_mask(bool r, bool g, bool b, bool a)
GPUFence * GPU_fence_create()
void GPU_depth_range(float near, float far)
void GPU_viewport_size_get_i(int coords[4])
void GPU_state_set(GPUWriteMask write_mask, GPUBlend blend, GPUFaceCullTest culling_test, GPUDepthTest depth_test, GPUStencilTest stencil_test, GPUStencilOp stencil_op, GPUProvokingVertex provoking_vert)
void GPU_stencil_reference_set(uint reference)
void GPU_scissor(int x, int y, int width, int height)
GPUDepthTest GPU_depth_test_get()
float GPU_line_width_get()
void GPU_stencil_compare_mask_set(uint compare_mask)
GPUFaceCullTest GPU_face_culling_get()
void GPU_memory_barrier(GPUBarrier barrier)
#define SET_MUTABLE_STATE(_state, _value)
void GPU_front_facing(bool invert)
void GPU_viewport(int x, int y, int width, int height)
void GPU_fence_wait(GPUFence *fence)
void GPU_point_size(float size)
void GPU_write_mask(GPUWriteMask mask)
GPUWriteMask GPU_write_mask_get()
uint GPU_stencil_mask_get()
#define SET_IMMUTABLE_STATE(_state, _value)
void GPU_fence_signal(GPUFence *fence)
void GPU_viewport_size_get_f(float coords[4])
bool GPU_depth_mask_get()
void GPU_clip_control_unit_range(bool enable)
void GPU_scissor_get(int coords[4])
void GPU_clip_distances(int distances_enabled)
void GPU_fence_free(GPUFence *fence)
void GPU_polygon_smooth(bool enable)
void GPU_shadow_offset(bool enable)
CCL_NAMESPACE_BEGIN ccl_device float invert(const float color, const float factor)
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
static Context * unwrap(GPUContext *ctx)
static GPUContext * wrap(Context *ctx)
static int blend(const Tex *tex, const float texvec[3], TexResult *texres)