{
unsigned dim = 1 + ((tx->info->projected >> (2 * idx)) & 3);
struct ureg_dst tmp;
+ boolean shadow = !!(tx->info->sampler_mask_shadow & (1 << idx));
/* dim == 1: no projection
* Looks like must be disabled when it makes no
* sense according the texture dimensions
*/
- if (dim == 1 || dim <= target) {
+ if (dim == 1 || (dim <= target && !shadow)) {
ureg_TEX(tx->ureg, dst, target, src0, src1);
} else if (dim == 4) {
ureg_TXP(tx->ureg, dst, target, src0, src1);
static inline unsigned
ps1x_sampler_type(const struct nine_shader_info *info, unsigned stage)
{
+ boolean shadow = !!(info->sampler_mask_shadow & (1 << stage));
switch ((info->sampler_ps1xtypes >> (stage * 2)) & 0x3) {
- case 1: return TGSI_TEXTURE_1D;
- case 0: return TGSI_TEXTURE_2D;
+ case 1: return shadow ? TGSI_TEXTURE_SHADOW1D : TGSI_TEXTURE_1D;
+ case 0: return shadow ? TGSI_TEXTURE_SHADOW2D : TGSI_TEXTURE_2D;
case 3: return TGSI_TEXTURE_3D;
default:
return TGSI_TEXTURE_CUBE;
info.const_b_base = NINE_CONST_B_BASE(device->max_ps_const_f) / 16;
info.byte_code = This->byte_code.tokens;
info.sampler_mask_shadow = key & 0xffff;
- info.sampler_ps1xtypes = key;
+ info.sampler_ps1xtypes = (key >> 16) & 0xffff;
info.fog_enable = device->context.rs[D3DRS_FOGENABLE];
info.fog_mode = device->context.rs[D3DRS_FOGTABLEMODE];
info.force_color_in_centroid = key >> 34 & 1;
struct nine_context *context )
{
uint16_t samplers_shadow;
- uint32_t samplers_ps1_types;
+ uint16_t samplers_ps1_types;
uint16_t projected;
uint64_t key;
BOOL res;
+ samplers_shadow = (uint16_t)((context->samplers_shadow & NINE_PS_SAMPLERS_MASK) >> NINE_SAMPLER_PS(0));
+ key = samplers_shadow & ps->sampler_mask;
+
if (unlikely(ps->byte_code.version < 0x20)) {
- /* no depth textures, but variable targets */
+ /* variable targets */
uint32_t m = ps->sampler_mask;
samplers_ps1_types = 0;
while (m) {
m &= ~(1 << s);
samplers_ps1_types |= (context->texture[s].enabled ? context->texture[s].pstype : 1) << (s * 2);
}
- key = samplers_ps1_types;
- } else {
- samplers_shadow = (uint16_t)((context->samplers_shadow & NINE_PS_SAMPLERS_MASK) >> NINE_SAMPLER_PS(0));
- key = samplers_shadow & ps->sampler_mask;
+ /* Note: For ps 1.X, only samplers 0 1 2 and 3 are available (except 1.4 where 4 and 5 are available).
+ * Thus there is no overflow of samplers_ps1_types. */
+ key |= samplers_ps1_types << 16;
}
if (ps->byte_code.version < 0x30) {