From 48689ca14a0a28aa03a54b5fa57ecca67d2da051 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Thu, 31 Jan 2013 23:52:14 +0100 Subject: [PATCH] st/mesa: advertise ARB_shading_language_packing for GLSL >= 1.30 Reviewed-by: Brian Paul --- src/mesa/state_tracker/st_extensions.c | 1 + src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 214588f1fdf..4d2d43d7e0a 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -597,6 +597,7 @@ void st_init_extensions(struct st_context *st) /* Extensions that either depend on GLSL 1.30 or are a subset thereof. */ ctx->Extensions.ARB_conservative_depth = GL_TRUE; ctx->Extensions.ARB_shader_bit_encoding = GL_TRUE; + ctx->Extensions.ARB_shading_language_packing = GL_TRUE; ctx->Extensions.OES_depth_texture_cube_map = GL_TRUE; } else { /* Optional integer support for GLSL 1.2. */ diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 3e9ff805a4b..b20dfd5dbb5 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -5167,6 +5167,21 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) options->EmitNoIndirectUniform); } + if (ctx->Extensions.ARB_shading_language_packing) { + unsigned lower_inst = LOWER_PACK_SNORM_2x16 | + LOWER_UNPACK_SNORM_2x16 | + LOWER_PACK_UNORM_2x16 | + LOWER_UNPACK_UNORM_2x16 | + LOWER_PACK_SNORM_4x8 | + LOWER_UNPACK_SNORM_4x8 | + LOWER_UNPACK_UNORM_4x8 | + LOWER_PACK_UNORM_4x8 | + LOWER_PACK_HALF_2x16 | + LOWER_UNPACK_HALF_2x16; + + lower_packing_builtins(ir, lower_inst); + } + do_mat_op_to_vec(ir); lower_instructions(ir, MOD_TO_FRACT | -- 2.30.2