summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/state_tracker/st_extensions.c31
-rw-r--r--src/mesa/state_tracker/st_glsl_to_tgsi.cpp11
2 files changed, 33 insertions, 9 deletions
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index a9d40543638..49c874710bd 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -263,12 +263,6 @@ void st_init_extensions(struct st_context *st)
ctx->Const.GLSLVersion = 120;
_mesa_override_glsl_version(st->ctx);
- /* Extensions that only depend on the GLSL version:
- */
- if (ctx->Const.GLSLVersion >= 130) {
- ctx->Extensions.ARB_conservative_depth = GL_TRUE;
- }
-
/*
* Extensions that are supported by all Gallium drivers:
*/
@@ -587,6 +581,23 @@ void st_init_extensions(struct st_context *st)
#endif
}
+ if (screen->get_shader_param(screen, PIPE_SHADER_VERTEX,
+ PIPE_SHADER_CAP_INTEGERS) &&
+ screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT,
+ PIPE_SHADER_CAP_INTEGERS)) {
+ ctx->Const.NativeIntegers = GL_TRUE;
+ }
+
+ if (ctx->Const.NativeIntegers)
+ ctx->Const.GLSLVersion = 130;
+
+ /* Extensions that only depend on the GLSL version:
+ */
+ if (ctx->Const.GLSLVersion >= 130) {
+ ctx->Extensions.ARB_conservative_depth = GL_TRUE;
+ ctx->Const.MaxClipPlanes = 8;
+ }
+
ctx->Extensions.NV_primitive_restart = GL_TRUE;
if (!screen->get_param(screen, PIPE_CAP_PRIMITIVE_RESTART)) {
st->sw_primitive_restart = GL_TRUE;
@@ -703,4 +714,12 @@ void st_init_extensions(struct st_context *st)
ctx->Extensions.ARB_transform_feedback2 = GL_TRUE;
}
}
+
+ if (ctx->Const.NativeIntegers &&
+ screen->is_format_supported(screen, PIPE_FORMAT_R32G32B32A32_UINT, PIPE_TEXTURE_2D, 0,
+ PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET) &&
+ screen->is_format_supported(screen, PIPE_FORMAT_R32G32B32A32_SINT, PIPE_TEXTURE_2D, 0,
+ PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET))
+ ctx->Extensions.EXT_texture_integer = GL_TRUE;
+
}
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index e450d130eb1..cb44e2b95b3 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -5010,13 +5010,18 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
num_clip_distances[i] = get_clip_distance_size(ir);
do {
+ unsigned what_to_lower = MOD_TO_FRACT | DIV_TO_MUL_RCP |
+ EXP_TO_EXP2 | LOG_TO_LOG2;
+ if (options->EmitNoPow)
+ what_to_lower |= POW_TO_EXP2;
+ if (!ctx->Const.NativeIntegers)
+ what_to_lower |= INT_DIV_TO_MUL_RCP;
+
progress = false;
/* Lowering */
do_mat_op_to_vec(ir);
- lower_instructions(ir, (MOD_TO_FRACT | DIV_TO_MUL_RCP | EXP_TO_EXP2
- | LOG_TO_LOG2 | INT_DIV_TO_MUL_RCP
- | ((options->EmitNoPow) ? POW_TO_EXP2 : 0)));
+ lower_instructions(ir, what_to_lower);
progress = do_lower_jumps(ir, true, true, options->EmitNoMainReturn, options->EmitNoCont, options->EmitNoLoops) || progress;