Cleanu: DRW: Remove unused types

This commit is contained in:
Clément Foucault
2024-12-05 19:39:27 +01:00
committed by Clément Foucault
parent e2fb51b2e8
commit db12edd825

View File

@@ -136,160 +136,6 @@ typedef struct DRWRegisteredDrawEngine {
*/
typedef uint32_t DRWResourceHandle;
BLI_INLINE uint32_t DRW_handle_negative_scale_get(const DRWResourceHandle *handle)
{
return (*handle & 0x80000000) != 0;
}
BLI_INLINE uint32_t DRW_handle_chunk_get(const DRWResourceHandle *handle)
{
return (*handle & 0x7FFFFFFF) >> 9;
}
BLI_INLINE uint32_t DRW_handle_id_get(const DRWResourceHandle *handle)
{
return (*handle & 0x000001FF);
}
BLI_INLINE void DRW_handle_increment(DRWResourceHandle *handle)
{
*handle += 1;
}
BLI_INLINE void DRW_handle_negative_scale_enable(DRWResourceHandle *handle)
{
*handle |= 0x80000000;
}
BLI_INLINE void *DRW_memblock_elem_from_handle(BLI_memblock *memblock,
const DRWResourceHandle *handle)
{
int elem = DRW_handle_id_get(handle);
int chunk = DRW_handle_chunk_get(handle);
return BLI_memblock_elem_get(memblock, chunk, elem);
}
struct DRWObjectMatrix {
float model[4][4];
float modelinverse[4][4];
};
struct DRWObjectInfos {
float orcotexfac[2][4];
float ob_color[4];
float ob_index;
float pad; /*UNUSED*/
float ob_random;
float ob_flag; /* Sign is negative scaling. */
};
BLI_STATIC_ASSERT_ALIGN(DRWObjectMatrix, 16)
BLI_STATIC_ASSERT_ALIGN(DRWObjectInfos, 16)
/** Used by #DRWUniform.type */
/* TODO(@jbakker): rename to DRW_RESOURCE/DRWResourceType. */
typedef enum {
DRW_UNIFORM_INT = 0,
DRW_UNIFORM_INT_COPY,
DRW_UNIFORM_FLOAT,
DRW_UNIFORM_FLOAT_COPY,
DRW_UNIFORM_TEXTURE,
DRW_UNIFORM_TEXTURE_REF,
DRW_UNIFORM_IMAGE,
DRW_UNIFORM_IMAGE_REF,
DRW_UNIFORM_BLOCK,
DRW_UNIFORM_BLOCK_REF,
DRW_UNIFORM_STORAGE_BLOCK,
DRW_UNIFORM_STORAGE_BLOCK_REF,
DRW_UNIFORM_TFEEDBACK_TARGET,
DRW_UNIFORM_VERTEX_BUFFER_AS_TEXTURE,
DRW_UNIFORM_VERTEX_BUFFER_AS_TEXTURE_REF,
DRW_UNIFORM_VERTEX_BUFFER_AS_STORAGE,
DRW_UNIFORM_VERTEX_BUFFER_AS_STORAGE_REF,
/** Per drawcall uniforms/UBO */
DRW_UNIFORM_BLOCK_OBMATS,
DRW_UNIFORM_BLOCK_OBINFOS,
DRW_UNIFORM_BLOCK_OBATTRS,
DRW_UNIFORM_BLOCK_VLATTRS,
DRW_UNIFORM_RESOURCE_CHUNK,
DRW_UNIFORM_RESOURCE_ID,
/** Legacy / Fallback */
DRW_UNIFORM_BASE_INSTANCE,
DRW_UNIFORM_MODEL_MATRIX,
DRW_UNIFORM_MODEL_MATRIX_INVERSE,
/* WARNING: set DRWUniform->type
* bit length accordingly. */
} DRWUniformType;
struct DRWUniform {
union {
/* For reference or array/vector types. */
const void *pvalue;
/* DRW_UNIFORM_TEXTURE */
struct {
union {
GPUTexture *texture;
GPUTexture **texture_ref;
};
GPUSamplerState sampler_state;
};
/* DRW_UNIFORM_BLOCK */
union {
GPUUniformBuf *block;
GPUUniformBuf **block_ref;
};
/* DRW_UNIFORM_STORAGE_BLOCK */
union {
GPUStorageBuf *ssbo;
GPUStorageBuf **ssbo_ref;
};
/* DRW_UNIFORM_VERTEX_BUFFER_AS_STORAGE */
union {
blender::gpu::VertBuf *vertbuf;
blender::gpu::VertBuf **vertbuf_ref;
};
/* DRW_UNIFORM_FLOAT_COPY */
float fvalue[4];
/* DRW_UNIFORM_INT_COPY */
int ivalue[4];
/* DRW_UNIFORM_BLOCK_OBATTRS */
const struct GPUUniformAttrList *uniform_attrs;
};
int location; /* Uniform location or binding point for textures and UBO's. */
uint8_t type; /* #DRWUniformType */
uint8_t length; /* Length of vector types. */
uint8_t arraysize; /* Array size of scalar/vector types. */
};
struct DRWShadingGroup {
DRWShadingGroup *next;
GPUShader *shader; /* Shader to bind */
DRWUniformChunk *uniforms; /* Uniforms pointers */
struct {
/* Chunks of draw calls. */
struct DRWCommandChunk *first, *last;
} cmd;
union {
/* This struct is used during cache populate. */
struct {
int objectinfo; /* Equal to 1 if the shader needs obinfos. */
DRWResourceHandle pass_handle; /* Memblock key to parent pass. */
/* Set of uniform attributes used by this shader. */
const struct GPUUniformAttrList *uniform_attrs;
};
/* This struct is used after cache populate if using the Z sorting.
* It will not conflict with the above struct. */
struct {
float distance; /* Distance from camera. */
uint original_index; /* Original position inside the shgroup list. */
} z_sorting;
};
};
/** \} */
/* -------------------------------------------------------------------- */