PyGPU: remove outdated function 'code_from_builtin'

Since shader sources are now parsed on demand via `GPUShaderCreateInfo`,
sources are not available to be read via
`GPU_shader_get_builtin_shader_code`.

Currently this results in a crash as the code tries to read `NULL`
pointers.

`GPU_shader_get_builtin_shader_code` was created with the intention of
informing the user how a builtin shader works, thus "replacing"
detailed documentation.

Therefore this function doesn't really have a practical use in an addon.

So, instead of updating the function (which would require several
changes to the gpu module), remove it and improve the documentation.

Release Notes: https://wiki.blender.org/wiki/Reference/Release_Notes/3.2/Python_API#Breaking_Changes

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D14678
This commit is contained in:
Germano Cavalcante
2022-04-19 11:15:22 -03:00
committed by Germano Cavalcante
parent 47de3659f0
commit 3e98331a09
3 changed files with 36 additions and 108 deletions

View File

@@ -371,12 +371,6 @@ GPUShader *GPU_shader_get_builtin_shader_with_config(eGPUBuiltinShader shader,
eGPUShaderConfig sh_cfg);
GPUShader *GPU_shader_get_builtin_shader(eGPUBuiltinShader shader);
void GPU_shader_get_builtin_shader_code(eGPUBuiltinShader shader,
const char **r_vert,
const char **r_frag,
const char **r_geom,
const char **r_defines);
void GPU_shader_free_builtin_shaders(void);
/* Vertex attributes for shaders */

View File

@@ -402,19 +402,6 @@ GPUShader *GPU_shader_get_builtin_shader(eGPUBuiltinShader shader)
return GPU_shader_get_builtin_shader_with_config(shader, GPU_SHADER_CFG_DEFAULT);
}
void GPU_shader_get_builtin_shader_code(eGPUBuiltinShader shader,
const char **r_vert,
const char **r_frag,
const char **r_geom,
const char **r_defines)
{
const GPUShaderStages *stages = &builtin_shader_stages[shader];
*r_vert = stages->vert;
*r_frag = stages->frag;
*r_geom = stages->geom;
*r_defines = stages->defs;
}
void GPU_shader_free_builtin_shaders(void)
{
for (int i = 0; i < GPU_SHADER_CFG_LEN; i++) {