diff --git a/src/gallium/drivers/llvmpipe/lp_jit.c b/src/gallium/drivers/llvmpipe/lp_jit.c index 00b6477f98c..39910c66837 100644 --- a/src/gallium/drivers/llvmpipe/lp_jit.c +++ b/src/gallium/drivers/llvmpipe/lp_jit.c @@ -52,6 +52,8 @@ create_jit_texture_type(struct gallivm_state *gallivm) elem_types[LP_JIT_TEXTURE_WIDTH] = elem_types[LP_JIT_TEXTURE_HEIGHT] = elem_types[LP_JIT_TEXTURE_DEPTH] = + elem_types[LP_JIT_TEXTURE_NUM_SAMPLES] = + elem_types[LP_JIT_TEXTURE_SAMPLE_STRIDE] = elem_types[LP_JIT_TEXTURE_FIRST_LEVEL] = elem_types[LP_JIT_TEXTURE_LAST_LEVEL] = LLVMInt32TypeInContext(lc); elem_types[LP_JIT_TEXTURE_BASE] = LLVMPointerType(LLVMInt8TypeInContext(lc), 0); @@ -90,6 +92,12 @@ create_jit_texture_type(struct gallivm_state *gallivm) LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, mip_offsets, gallivm->target, texture_type, LP_JIT_TEXTURE_MIP_OFFSETS); + LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, num_samples, + gallivm->target, texture_type, + LP_JIT_TEXTURE_NUM_SAMPLES); + LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, sample_stride, + gallivm->target, texture_type, + LP_JIT_TEXTURE_SAMPLE_STRIDE); LP_CHECK_STRUCT_SIZE(struct lp_jit_texture, gallivm->target, texture_type); return texture_type; diff --git a/src/gallium/drivers/llvmpipe/lp_jit.h b/src/gallium/drivers/llvmpipe/lp_jit.h index 71931e15eb7..b89f25b8dba 100644 --- a/src/gallium/drivers/llvmpipe/lp_jit.h +++ b/src/gallium/drivers/llvmpipe/lp_jit.h @@ -60,6 +60,8 @@ struct lp_jit_texture uint32_t first_level; uint32_t last_level; uint32_t mip_offsets[LP_MAX_TEXTURE_LEVELS]; + uint32_t num_samples; + uint32_t sample_stride; }; @@ -99,6 +101,8 @@ enum { LP_JIT_TEXTURE_FIRST_LEVEL, LP_JIT_TEXTURE_LAST_LEVEL, LP_JIT_TEXTURE_MIP_OFFSETS, + LP_JIT_TEXTURE_NUM_SAMPLES, + LP_JIT_TEXTURE_SAMPLE_STRIDE, LP_JIT_TEXTURE_NUM_FIELDS /* number of fields above */ }; diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index 583c0bdba21..e67392059a3 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -922,6 +922,8 @@ lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup, jit_tex->mip_offsets[0] = 0; jit_tex->row_stride[0] = 0; jit_tex->img_stride[0] = 0; + jit_tex->num_samples = 0; + jit_tex->sample_stride = 0; } else { jit_tex->width = res->width0; @@ -929,6 +931,8 @@ lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup, jit_tex->depth = res->depth0; jit_tex->first_level = first_level; jit_tex->last_level = last_level; + jit_tex->num_samples = res->nr_samples; + jit_tex->sample_stride = 0; if (llvmpipe_resource_is_texture(res)) { for (j = first_level; j <= last_level; j++) { @@ -995,6 +999,8 @@ lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup, jit_tex->height = res->height0; jit_tex->depth = res->depth0; jit_tex->first_level = jit_tex->last_level = 0; + jit_tex->sample_stride = res->nr_samples; + jit_tex->sample_stride = 0; assert(jit_tex->base); } } diff --git a/src/gallium/drivers/llvmpipe/lp_state_cs.c b/src/gallium/drivers/llvmpipe/lp_state_cs.c index ff767a2a860..da5eed7abd3 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_cs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_cs.c @@ -862,6 +862,8 @@ lp_csctx_set_sampler_views(struct lp_cs_context *csctx, jit_tex->mip_offsets[0] = 0; jit_tex->row_stride[0] = 0; jit_tex->img_stride[0] = 0; + jit_tex->num_samples = 0; + jit_tex->sample_stride = 0; } else { jit_tex->width = res->width0; @@ -869,6 +871,8 @@ lp_csctx_set_sampler_views(struct lp_cs_context *csctx, jit_tex->depth = res->depth0; jit_tex->first_level = first_level; jit_tex->last_level = last_level; + jit_tex->num_samples = res->nr_samples; + jit_tex->sample_stride = 0; if (llvmpipe_resource_is_texture(res)) { for (j = first_level; j <= last_level; j++) { @@ -935,6 +939,8 @@ lp_csctx_set_sampler_views(struct lp_cs_context *csctx, jit_tex->height = res->height0; jit_tex->depth = res->depth0; jit_tex->first_level = jit_tex->last_level = 0; + jit_tex->num_samples = res->nr_samples; + jit_tex->sample_stride = 0; assert(jit_tex->base); } } diff --git a/src/gallium/drivers/llvmpipe/lp_state_sampler.c b/src/gallium/drivers/llvmpipe/lp_state_sampler.c index 65342e80eae..723e472720e 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_sampler.c +++ b/src/gallium/drivers/llvmpipe/lp_state_sampler.c @@ -268,6 +268,8 @@ prepare_shader_sampling( unsigned num_layers = tex->depth0; unsigned first_level = 0; unsigned last_level = 0; + unsigned sample_stride = 0; + unsigned num_samples = tex->nr_samples; if (!lp_tex->dt) { /* regular texture - setup array of mipmap level offsets */ @@ -335,7 +337,8 @@ prepare_shader_sampling( shader_type, i, width0, tex->height0, num_layers, - first_level, last_level, 0, 0, + first_level, last_level, + num_samples, sample_stride, addr, row_stride, img_stride, mip_offsets); } diff --git a/src/gallium/drivers/llvmpipe/lp_tex_sample.c b/src/gallium/drivers/llvmpipe/lp_tex_sample.c index 3051774e8c4..326fde79f94 100644 --- a/src/gallium/drivers/llvmpipe/lp_tex_sample.c +++ b/src/gallium/drivers/llvmpipe/lp_tex_sample.c @@ -172,6 +172,8 @@ LP_LLVM_TEXTURE_MEMBER(base_ptr, LP_JIT_TEXTURE_BASE, TRUE) LP_LLVM_TEXTURE_MEMBER(row_stride, LP_JIT_TEXTURE_ROW_STRIDE, FALSE) LP_LLVM_TEXTURE_MEMBER(img_stride, LP_JIT_TEXTURE_IMG_STRIDE, FALSE) LP_LLVM_TEXTURE_MEMBER(mip_offsets, LP_JIT_TEXTURE_MIP_OFFSETS, FALSE) +LP_LLVM_TEXTURE_MEMBER(num_samples, LP_JIT_TEXTURE_NUM_SAMPLES, TRUE) +LP_LLVM_TEXTURE_MEMBER(sample_stride, LP_JIT_TEXTURE_SAMPLE_STRIDE, TRUE) /** @@ -401,6 +403,8 @@ lp_llvm_sampler_soa_create(const struct lp_sampler_static_state *static_state) sampler->dynamic_state.base.row_stride = lp_llvm_texture_row_stride; sampler->dynamic_state.base.img_stride = lp_llvm_texture_img_stride; sampler->dynamic_state.base.mip_offsets = lp_llvm_texture_mip_offsets; + sampler->dynamic_state.base.num_samples = lp_llvm_texture_num_samples; + sampler->dynamic_state.base.sample_stride = lp_llvm_texture_sample_stride; sampler->dynamic_state.base.min_lod = lp_llvm_sampler_min_lod; sampler->dynamic_state.base.max_lod = lp_llvm_sampler_max_lod; sampler->dynamic_state.base.lod_bias = lp_llvm_sampler_lod_bias;