forked from enlightenment/efl
Evas GL shaders: Simplify a bit the shaders code
Following raster's change, the Program_Source struct is useless. This is a big commit, again, but really all is auto-generated.
This commit is contained in:
parent
a3cec656c8
commit
4a830877f0
|
@ -710,7 +710,7 @@ modules/evas/engines/gl_common/shader/evas_gl_shaders_bigendian.x: $(GL_SHADERS_
|
|||
@echo " SHADERS $@"
|
||||
@bash $(srcdir)/modules/evas/engines/gl_common/shader/gen_shaders.sh _bigendian
|
||||
|
||||
modules/evas/engines/gl_common/shader/evas_gl_enum.x: modules/evas/engines/gl_common/shader/evas_gl_shaders.x
|
||||
modules/evas/engines/gl_common/shader/evas_gl_enum.x: modules/evas/engines/gl_common/shader/evas_gl_shaders.x modules/evas/engines/gl_common/shader/evas_gl_shaders_bigendian.x
|
||||
|
||||
# NOTE: order here should be equal with modes in file Evas_Eo.h
|
||||
GL_SHADERS_3D_GEN = \
|
||||
|
|
|
@ -54,7 +54,6 @@
|
|||
#define SHAD_MASKSAM 8
|
||||
|
||||
typedef struct _Evas_GL_Program Evas_GL_Program;
|
||||
typedef struct _Evas_GL_Program_Source Evas_GL_Program_Source;
|
||||
typedef struct _Evas_GL_Shared Evas_GL_Shared;
|
||||
typedef struct _Evas_Engine_GL_Context Evas_Engine_GL_Context;
|
||||
typedef struct _Evas_GL_Texture_Pool Evas_GL_Texture_Pool;
|
||||
|
@ -105,11 +104,6 @@ struct _Evas_GL_Program
|
|||
Eina_Bool reset;
|
||||
};
|
||||
|
||||
struct _Evas_GL_Program_Source
|
||||
{
|
||||
const char *src;
|
||||
};
|
||||
|
||||
struct _Evas_GL_Shared
|
||||
{
|
||||
Eina_List *images;
|
||||
|
|
|
@ -143,8 +143,8 @@ _evas_gl_common_shader_program_binary_save(Evas_GL_Program *p,
|
|||
|
||||
static int
|
||||
_evas_gl_common_shader_program_source_init(Evas_GL_Program *p,
|
||||
Evas_GL_Program_Source *vert,
|
||||
Evas_GL_Program_Source *frag,
|
||||
const char *vert,
|
||||
const char *frag,
|
||||
const char *name)
|
||||
{
|
||||
GLint ok;
|
||||
|
@ -152,26 +152,24 @@ _evas_gl_common_shader_program_source_init(Evas_GL_Program *p,
|
|||
p->vert = glCreateShader(GL_VERTEX_SHADER);
|
||||
p->frag = glCreateShader(GL_FRAGMENT_SHADER);
|
||||
|
||||
glShaderSource(p->vert, 1,
|
||||
(const char **)&(vert->src), NULL);
|
||||
glShaderSource(p->vert, 1, &vert, NULL);
|
||||
glCompileShader(p->vert);
|
||||
ok = 0;
|
||||
glGetShaderiv(p->vert, GL_COMPILE_STATUS, &ok);
|
||||
if (!ok)
|
||||
{
|
||||
gl_compile_link_error(p->vert, "compile vertex shader");
|
||||
ERR("Abort compile of shader vert (%s): %s", name, vert->src);
|
||||
ERR("Abort compile of shader vert (%s): %s", name, vert);
|
||||
return 0;
|
||||
}
|
||||
glShaderSource(p->frag, 1,
|
||||
(const char **)&(frag->src), NULL);
|
||||
glShaderSource(p->frag, 1, &frag, NULL);
|
||||
glCompileShader(p->frag);
|
||||
ok = 0;
|
||||
glGetShaderiv(p->frag, GL_COMPILE_STATUS, &ok);
|
||||
if (!ok)
|
||||
{
|
||||
gl_compile_link_error(p->frag, "compile fragment shader");
|
||||
ERR("Abort compile of shader frag (%s): %s", name, frag->src);
|
||||
ERR("Abort compile of shader frag (%s): %s", name, frag);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -203,8 +201,8 @@ _evas_gl_common_shader_program_source_init(Evas_GL_Program *p,
|
|||
if (!ok)
|
||||
{
|
||||
gl_compile_link_error(p->prog, "link fragment and vertex shaders");
|
||||
ERR("Abort compile of shader frag (%s): %s", name, frag->src);
|
||||
ERR("Abort compile of shader vert (%s): %s", name, vert->src);
|
||||
ERR("Abort compile of shader frag (%s): %s", name, frag);
|
||||
ERR("Abort compile of shader vert (%s): %s", name, vert);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -142,17 +142,15 @@ for (( i = 0; i < ${#SHADERS[@]} ; i++ )) ; do
|
|||
|
||||
OIFS=$IFS
|
||||
IFS=$'\n'
|
||||
printf "static const char ${shdname}_glsl[] =" >> ${OUTPUT}
|
||||
printf "static const char ${shdname}_src[] =" >> ${OUTPUT}
|
||||
for line in `cat ${shd}` ; do
|
||||
printf "\n \"${line}\\\n\"" >> ${OUTPUT}
|
||||
done
|
||||
printf ";\n" >> ${OUTPUT}
|
||||
printf ";\n\n" >> ${OUTPUT}
|
||||
IFS=${OIFS}
|
||||
|
||||
printf "Evas_GL_Program_Source shader_${shdname}_src =\n{\n ${shdname}_glsl\n};\n\n" >> ${OUTPUT}
|
||||
done
|
||||
|
||||
shaders_source="${shaders_source} { SHADER_${UNAME}, &(shader_${name}_vert_src), &(shader_${name}_frag_src), \"${name}\", SHD_${TYPE}, SHD_${sam}, SHD_${masksam}, ${bgra}, ${mask}, ${nomul}, ${afill} },\n"
|
||||
shaders_source="${shaders_source} { SHADER_${UNAME}, ${name}_vert_src, ${name}_frag_src, \"${name}\", SHD_${TYPE}, SHD_${sam}, SHD_${masksam}, ${bgra}, ${mask}, ${nomul}, ${afill} },\n"
|
||||
shaders_enum="${shaders_enum} SHADER_${UNAME},\n"
|
||||
|
||||
# Bind textures to the programs. Only if there is more than 1 texture.
|
||||
|
@ -167,8 +165,8 @@ done
|
|||
printf "
|
||||
static const struct {
|
||||
Evas_GL_Shader id;
|
||||
Evas_GL_Program_Source *vert;
|
||||
Evas_GL_Program_Source *frag;
|
||||
const char *vert;
|
||||
const char *frag;
|
||||
const char *name;
|
||||
Shader_Type type;
|
||||
Shader_Sampling sam;
|
||||
|
|
Loading…
Reference in New Issue