wined3d: Implement SM4 sample_l instruction.
authorJózef Kucia <jkucia@codeweavers.com>
Mon, 4 Jan 2016 12:03:37 +0000 (13:03 +0100)
committerAlexandre Julliard <julliard@winehq.org>
Tue, 5 Jan 2016 10:51:06 +0000 (11:51 +0100)
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
dlls/wined3d/glsl_shader.c

index 366c6ec8a4984070c98b478aebfc2a9f82c6e5ab..818d55859c36fa5da65656b0a927668d0554e922 100644 (file)
@@ -4244,6 +4244,23 @@ static void shader_glsl_sample(const struct wined3d_shader_instruction *ins)
     shader_glsl_release_sample_function(ins->ctx, &sample_function);
 }
 
+static void shader_glsl_sample_lod(const struct wined3d_shader_instruction *ins)
+{
+    struct glsl_src_param coord_param, lod_param;
+    struct glsl_sample_function sample_function;
+    unsigned int sampler_idx;
+
+    shader_glsl_get_sample_function(ins->ctx, ins->src[1].reg.idx[0].offset,
+            WINED3D_GLSL_SAMPLE_LOD, &sample_function);
+    shader_glsl_add_src_param(ins, &ins->src[0], sample_function.coord_mask, &coord_param);
+    shader_glsl_add_src_param(ins, &ins->src[3], WINED3DSP_WRITEMASK_0, &lod_param);
+    sampler_idx = shader_glsl_find_sampler(&ins->ctx->reg_maps->sampler_map,
+            ins->src[1].reg.idx[0].offset, ins->src[2].reg.idx[0].offset);
+    shader_glsl_gen_sample_code(ins, sampler_idx, &sample_function, WINED3DSP_NOSWIZZLE,
+            NULL, NULL, lod_param.param_str, "%s", coord_param.param_str);
+    shader_glsl_release_sample_function(ins->ctx, &sample_function);
+}
+
 static void shader_glsl_texcoord(const struct wined3d_shader_instruction *ins)
 {
     /* FIXME: Make this work for more than just 2D textures */
@@ -7895,7 +7912,7 @@ static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TAB
     /* WINED3DSIH_RSQ                   */ shader_glsl_scalar_op,
     /* WINED3DSIH_SAMPLE                */ shader_glsl_sample,
     /* WINED3DSIH_SAMPLE_GRAD           */ NULL,
-    /* WINED3DSIH_SAMPLE_LOD            */ NULL,
+    /* WINED3DSIH_SAMPLE_LOD            */ shader_glsl_sample_lod,
     /* WINED3DSIH_SETP                  */ NULL,
     /* WINED3DSIH_SGE                   */ shader_glsl_compare,
     /* WINED3DSIH_SGN                   */ shader_glsl_sgn,