glamor: add EXT_gpu_shader4 support
This enables a number of the GLSL 1.30 paths on GPUs that have EXT_gpu_shader4 but don't have GLSL 1.30 exposed. (Intel gen4/5 mainly) Reviewed-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
parent
a2f5b917f5
commit
a955286869
|
@ -772,6 +772,10 @@ glamor_init(ScreenPtr screen, unsigned int flags)
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!glamor_priv->is_gles && glamor_priv->glsl_version == 120 &&
|
||||||
|
epoxy_has_gl_extension("GL_ARB_instanced_arrays"))
|
||||||
|
glamor_priv->use_gpu_shader4 = epoxy_has_gl_extension("GL_EXT_gpu_shader4");
|
||||||
|
|
||||||
glamor_priv->has_rw_pbo = FALSE;
|
glamor_priv->has_rw_pbo = FALSE;
|
||||||
if (!glamor_priv->is_gles)
|
if (!glamor_priv->is_gles)
|
||||||
glamor_priv->has_rw_pbo = TRUE;
|
glamor_priv->has_rw_pbo = TRUE;
|
||||||
|
|
|
@ -213,6 +213,7 @@ typedef struct glamor_screen_private {
|
||||||
Bool has_texture_swizzle;
|
Bool has_texture_swizzle;
|
||||||
Bool is_core_profile;
|
Bool is_core_profile;
|
||||||
Bool can_copyplane;
|
Bool can_copyplane;
|
||||||
|
Bool use_gpu_shader4;
|
||||||
int max_fbo_size;
|
int max_fbo_size;
|
||||||
|
|
||||||
struct glamor_format formats[33];
|
struct glamor_format formats[33];
|
||||||
|
|
|
@ -187,6 +187,7 @@ fs_location_vars(glamor_program_location locations)
|
||||||
|
|
||||||
static const char vs_template[] =
|
static const char vs_template[] =
|
||||||
"%s" /* version */
|
"%s" /* version */
|
||||||
|
"%s" /* exts */
|
||||||
"%s" /* defines */
|
"%s" /* defines */
|
||||||
"%s" /* prim vs_vars */
|
"%s" /* prim vs_vars */
|
||||||
"%s" /* fill vs_vars */
|
"%s" /* fill vs_vars */
|
||||||
|
@ -199,6 +200,7 @@ static const char vs_template[] =
|
||||||
|
|
||||||
static const char fs_template[] =
|
static const char fs_template[] =
|
||||||
"%s" /* version */
|
"%s" /* version */
|
||||||
|
"%s" /* exts */
|
||||||
GLAMOR_DEFAULT_PRECISION
|
GLAMOR_DEFAULT_PRECISION
|
||||||
"%s" /* defines */
|
"%s" /* defines */
|
||||||
"%s" /* prim fs_vars */
|
"%s" /* prim fs_vars */
|
||||||
|
@ -262,6 +264,7 @@ glamor_build_program(ScreenPtr screen,
|
||||||
char *fs_prog_string;
|
char *fs_prog_string;
|
||||||
|
|
||||||
GLint fs_prog, vs_prog;
|
GLint fs_prog, vs_prog;
|
||||||
|
Bool gpu_shader4 = FALSE;
|
||||||
|
|
||||||
if (!fill)
|
if (!fill)
|
||||||
fill = &facet_null_fill;
|
fill = &facet_null_fill;
|
||||||
|
@ -270,8 +273,14 @@ glamor_build_program(ScreenPtr screen,
|
||||||
flags |= fill->flags;
|
flags |= fill->flags;
|
||||||
version = MAX(version, fill->version);
|
version = MAX(version, fill->version);
|
||||||
|
|
||||||
if (version > glamor_priv->glsl_version)
|
if (version > glamor_priv->glsl_version) {
|
||||||
|
if (version == 130 && !glamor_priv->use_gpu_shader4)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
else {
|
||||||
|
version = 120;
|
||||||
|
gpu_shader4 = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
vs_vars = vs_location_vars(locations);
|
vs_vars = vs_location_vars(locations);
|
||||||
fs_vars = fs_location_vars(locations);
|
fs_vars = fs_location_vars(locations);
|
||||||
|
@ -291,6 +300,7 @@ glamor_build_program(ScreenPtr screen,
|
||||||
if (asprintf(&vs_prog_string,
|
if (asprintf(&vs_prog_string,
|
||||||
vs_template,
|
vs_template,
|
||||||
str(version_string),
|
str(version_string),
|
||||||
|
gpu_shader4 ? "#extension GL_EXT_gpu_shader4 : require\n" : "",
|
||||||
str(defines),
|
str(defines),
|
||||||
str(prim->vs_vars),
|
str(prim->vs_vars),
|
||||||
str(fill->vs_vars),
|
str(fill->vs_vars),
|
||||||
|
@ -302,6 +312,7 @@ glamor_build_program(ScreenPtr screen,
|
||||||
if (asprintf(&fs_prog_string,
|
if (asprintf(&fs_prog_string,
|
||||||
fs_template,
|
fs_template,
|
||||||
str(version_string),
|
str(version_string),
|
||||||
|
gpu_shader4 ? "#extension GL_EXT_gpu_shader4 : require\n#define texelFetch texelFetch2D\n#define uint unsigned int\n" : "",
|
||||||
str(defines),
|
str(defines),
|
||||||
str(prim->fs_vars),
|
str(prim->fs_vars),
|
||||||
str(fill->fs_vars),
|
str(fill->fs_vars),
|
||||||
|
|
|
@ -734,7 +734,7 @@ glamor_glDrawArrays_GL_QUADS(glamor_screen_private *glamor_priv, unsigned count)
|
||||||
|
|
||||||
static inline Bool
|
static inline Bool
|
||||||
glamor_glsl_has_ints(glamor_screen_private *glamor_priv) {
|
glamor_glsl_has_ints(glamor_screen_private *glamor_priv) {
|
||||||
return glamor_priv->glsl_version >= 130;
|
return glamor_priv->glsl_version >= 130 || glamor_priv->use_gpu_shader4;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue
Block a user