aboutsummaryrefslogtreecommitdiff
path: root/mesalib
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib')
-rw-r--r--mesalib/src/glsl/glcpp/glcpp-parse.y4
-rw-r--r--mesalib/src/glsl/glsl_parser_extras.cpp8
-rw-r--r--mesalib/src/glsl/glsl_parser_extras.h2
-rw-r--r--mesalib/src/mesa/main/extensions.c2
-rw-r--r--mesalib/src/mesa/main/mtypes.h1
-rw-r--r--mesalib/src/mesa/program/ir_to_mesa.cpp13
-rw-r--r--mesalib/src/mesa/program/prog_instruction.h28
7 files changed, 41 insertions, 17 deletions
diff --git a/mesalib/src/glsl/glcpp/glcpp-parse.y b/mesalib/src/glsl/glcpp/glcpp-parse.y
index 6f15e85a1..0a35e88ce 100644
--- a/mesalib/src/glsl/glcpp/glcpp-parse.y
+++ b/mesalib/src/glsl/glcpp/glcpp-parse.y
@@ -1128,6 +1128,10 @@ glcpp_parser_create (const struct gl_extensions *extensions, int api)
if (extensions->ARB_explicit_attrib_location)
add_builtin_define(parser, "GL_ARB_explicit_attrib_location", 1);
+
+ if (extensions->ARB_shader_texture_lod)
+ add_builtin_define(parser, "GL_ARB_shader_texture_lod", 1);
+
if (extensions->AMD_conservative_depth)
add_builtin_define(parser, "GL_AMD_conservative_depth", 1);
}
diff --git a/mesalib/src/glsl/glsl_parser_extras.cpp b/mesalib/src/glsl/glsl_parser_extras.cpp
index 18bff88de..fce2faa75 100644
--- a/mesalib/src/glsl/glsl_parser_extras.cpp
+++ b/mesalib/src/glsl/glsl_parser_extras.cpp
@@ -240,6 +240,14 @@ _mesa_glsl_process_extension(const char *name, YYLTYPE *name_locp,
state->EXT_texture_array_warn = (ext_mode == extension_warn);
unsupported = !state->extensions->EXT_texture_array;
+ } else if (strcmp(name, "GL_ARB_shader_texture_lod") == 0) {
+ /* Force ARB_texture_rectangle to be on so sampler2DRects are defined */
+ state->ARB_texture_rectangle_enable = true;
+
+ state->ARB_shader_texture_lod_enable = (ext_mode != extension_disable);
+ state->ARB_shader_texture_lod_warn = (ext_mode == extension_warn);
+
+ unsupported = !state->extensions->ARB_shader_texture_lod;
} else if (strcmp(name, "GL_ARB_shader_stencil_export") == 0) {
state->ARB_shader_stencil_export_enable = (ext_mode != extension_disable);
state->ARB_shader_stencil_export_warn = (ext_mode == extension_warn);
diff --git a/mesalib/src/glsl/glsl_parser_extras.h b/mesalib/src/glsl/glsl_parser_extras.h
index f9147653f..878d2ae3f 100644
--- a/mesalib/src/glsl/glsl_parser_extras.h
+++ b/mesalib/src/glsl/glsl_parser_extras.h
@@ -168,6 +168,8 @@ struct _mesa_glsl_parse_state {
unsigned ARB_texture_rectangle_warn:1;
unsigned EXT_texture_array_enable:1;
unsigned EXT_texture_array_warn:1;
+ unsigned ARB_shader_texture_lod_enable:1;
+ unsigned ARB_shader_texture_lod_warn:1;
unsigned ARB_shader_stencil_export_enable:1;
unsigned ARB_shader_stencil_export_warn:1;
unsigned AMD_conservative_depth_enable:1;
diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c
index a9ef8fa4c..8672ac2a7 100644
--- a/mesalib/src/mesa/main/extensions.c
+++ b/mesalib/src/mesa/main/extensions.c
@@ -112,6 +112,7 @@ static const struct extension extension_table[] = {
{ "GL_ARB_seamless_cube_map", o(ARB_seamless_cube_map), GL, 2009 },
{ "GL_ARB_shader_objects", o(ARB_shader_objects), GL, 2002 },
{ "GL_ARB_shader_stencil_export", o(ARB_shader_stencil_export), GL, 2009 },
+ { "GL_ARB_shader_texture_lod", o(ARB_shader_texture_lod), GL, 2009 },
{ "GL_ARB_shading_language_100", o(ARB_shading_language_100), GL, 2003 },
{ "GL_ARB_shadow_ambient", o(ARB_shadow_ambient), GL, 2001 },
{ "GL_ARB_shadow", o(ARB_shadow), GL, 2001 },
@@ -143,7 +144,6 @@ static const struct extension extension_table[] = {
{ "GL_ARB_vertex_shader", o(ARB_vertex_shader), GL, 2002 },
{ "GL_ARB_vertex_type_2_10_10_10_rev", o(ARB_vertex_type_2_10_10_10_rev), GL, 2009 },
{ "GL_ARB_window_pos", o(ARB_window_pos), GL, 2001 },
-
/* EXT extensions */
{ "GL_EXT_abgr", o(EXT_abgr), GL, 1995 },
{ "GL_EXT_bgra", o(EXT_bgra), GL, 1995 },
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 29c8cfd23..eb2efc89a 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -2793,6 +2793,7 @@ struct gl_extensions
GLboolean ARB_seamless_cube_map;
GLboolean ARB_shader_objects;
GLboolean ARB_shader_stencil_export;
+ GLboolean ARB_shader_texture_lod;
GLboolean ARB_shading_language_100;
GLboolean ARB_shadow;
GLboolean ARB_shadow_ambient;
diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp
index bc10b455b..510aeab82 100644
--- a/mesalib/src/mesa/program/ir_to_mesa.cpp
+++ b/mesalib/src/mesa/program/ir_to_mesa.cpp
@@ -1966,7 +1966,7 @@ ir_to_mesa_visitor::visit(ir_call *ir)
void
ir_to_mesa_visitor::visit(ir_texture *ir)
{
- src_reg result_src, coord, lod_info, projector;
+ src_reg result_src, coord, lod_info, projector, dx, dy;
dst_reg result_dst, coord_dst;
ir_to_mesa_instruction *inst = NULL;
prog_opcode opcode = OPCODE_NOP;
@@ -2008,6 +2008,12 @@ ir_to_mesa_visitor::visit(ir_texture *ir)
lod_info = this->result;
break;
case ir_txd:
+ opcode = OPCODE_TXD;
+ ir->lod_info.grad.dPdx->accept(this);
+ dx = this->result;
+ ir->lod_info.grad.dPdy->accept(this);
+ dy = this->result;
+ break;
case ir_txf:
assert(!"GLSL 1.30 features unsupported");
break;
@@ -2080,7 +2086,10 @@ ir_to_mesa_visitor::visit(ir_texture *ir)
coord_dst.writemask = WRITEMASK_XYZW;
}
- inst = emit(ir, opcode, result_dst, coord);
+ if (opcode == OPCODE_TXD)
+ inst = emit(ir, opcode, result_dst, coord, dx, dy);
+ else
+ inst = emit(ir, opcode, result_dst, coord);
if (ir->shadow_comparitor)
inst->tex_shadow = GL_TRUE;
diff --git a/mesalib/src/mesa/program/prog_instruction.h b/mesalib/src/mesa/program/prog_instruction.h
index 669d71029..db2b594e7 100644
--- a/mesalib/src/mesa/program/prog_instruction.h
+++ b/mesalib/src/mesa/program/prog_instruction.h
@@ -154,9 +154,9 @@ typedef enum prog_opcode {
OPCODE_ARR, /* 2 */
OPCODE_BGNLOOP, /* opt */
OPCODE_BGNSUB, /* opt */
- OPCODE_BRA, /* 2 X */
+ OPCODE_BRA, /* 2 */
OPCODE_BRK, /* 2 opt */
- OPCODE_CAL, /* 2 2 X */
+ OPCODE_CAL, /* 2 2 opt */
OPCODE_CMP, /* X X */
OPCODE_CONT, /* opt */
OPCODE_COS, /* X 2 X X */
@@ -168,7 +168,7 @@ typedef enum prog_opcode {
OPCODE_DP4, /* X X X X X */
OPCODE_DPH, /* X X 1.1 */
OPCODE_DST, /* X X X X */
- OPCODE_ELSE, /* X */
+ OPCODE_ELSE, /* opt */
OPCODE_EMIT_VERTEX,/* X */
OPCODE_END, /* X X X X opt */
OPCODE_END_PRIMITIVE,/* X */
@@ -176,16 +176,16 @@ typedef enum prog_opcode {
OPCODE_ENDLOOP, /* opt */
OPCODE_ENDSUB, /* opt */
OPCODE_EX2, /* X X 2 X X */
- OPCODE_EXP, /* X X X */
+ OPCODE_EXP, /* X X */
OPCODE_FLR, /* X X 2 X X */
OPCODE_FRC, /* X X 2 X X */
OPCODE_IF, /* opt */
- OPCODE_KIL, /* X */
+ OPCODE_KIL, /* X X */
OPCODE_KIL_NV, /* X X */
OPCODE_LG2, /* X X 2 X X */
OPCODE_LIT, /* X X X X */
- OPCODE_LOG, /* X X X */
- OPCODE_LRP, /* X X X */
+ OPCODE_LOG, /* X X */
+ OPCODE_LRP, /* X X */
OPCODE_MAD, /* X X X X X */
OPCODE_MAX, /* X X X X X */
OPCODE_MIN, /* X X X X X */
@@ -196,8 +196,8 @@ typedef enum prog_opcode {
OPCODE_NOISE3, /* X */
OPCODE_NOISE4, /* X */
OPCODE_NOT, /* */
- OPCODE_NRM3, /* X */
- OPCODE_NRM4, /* X */
+ OPCODE_NRM3, /* */
+ OPCODE_NRM4, /* */
OPCODE_OR, /* */
OPCODE_PK2H, /* X */
OPCODE_PK2US, /* X */
@@ -209,10 +209,10 @@ typedef enum prog_opcode {
OPCODE_PUSHA, /* 3 */
OPCODE_RCC, /* 1.1 */
OPCODE_RCP, /* X X X X X */
- OPCODE_RET, /* 2 2 X */
+ OPCODE_RET, /* 2 2 opt */
OPCODE_RFL, /* X X */
OPCODE_RSQ, /* X X X X X */
- OPCODE_SCS, /* X */
+ OPCODE_SCS, /* X X */
OPCODE_SEQ, /* 2 X X */
OPCODE_SFL, /* 2 X */
OPCODE_SGE, /* X X X X X */
@@ -221,10 +221,10 @@ typedef enum prog_opcode {
OPCODE_SLE, /* 2 X X */
OPCODE_SLT, /* X X X X X */
OPCODE_SNE, /* 2 X X */
- OPCODE_SSG, /* 2 */
+ OPCODE_SSG, /* 2 X */
OPCODE_STR, /* 2 X */
OPCODE_SUB, /* X X 1.1 X X */
- OPCODE_SWZ, /* X X */
+ OPCODE_SWZ, /* X X X */
OPCODE_TEX, /* X 3 X X */
OPCODE_TXB, /* X 3 X */
OPCODE_TXD, /* X X */
@@ -238,7 +238,7 @@ typedef enum prog_opcode {
OPCODE_UP4UB, /* X */
OPCODE_X2D, /* X */
OPCODE_XOR, /* */
- OPCODE_XPD, /* X X X */
+ OPCODE_XPD, /* X X */
MAX_OPCODE
} gl_inst_opcode;