Esempio n. 1
0
static void *
nv30_sampler_state_create(struct pipe_context *pipe,
                          const struct pipe_sampler_state *cso)
{
   struct nouveau_object *eng3d = nv30_context(pipe)->screen->eng3d;
   struct nv30_sampler_state *so;
   const float max_lod = 15.0 + (255.0 / 256.0);

   so = MALLOC_STRUCT(nv30_sampler_state);
   if (!so)
      return NULL;

   so->pipe  = *cso;
   so->fmt   = 0;
   so->wrap  = (wrap_mode(cso->wrap_s) << NV30_3D_TEX_WRAP_S__SHIFT) |
               (wrap_mode(cso->wrap_t) << NV30_3D_TEX_WRAP_T__SHIFT) |
               (wrap_mode(cso->wrap_r) << NV30_3D_TEX_WRAP_R__SHIFT);
   so->en    = 0;
   so->wrap |= compare_mode(cso);
   so->filt  = filter_mode(cso) | 0x00002000;
   so->bcol  = (float_to_ubyte(cso->border_color.f[3]) << 24) |
               (float_to_ubyte(cso->border_color.f[0]) << 16) |
               (float_to_ubyte(cso->border_color.f[1]) <<  8) |
               (float_to_ubyte(cso->border_color.f[2]) <<  0);

   if (eng3d->oclass >= NV40_3D_CLASS) {
      unsigned aniso = cso->max_anisotropy;

      if (!cso->normalized_coords)
         so->fmt |= NV40_3D_TEX_FORMAT_RECT;

      if (aniso > 1) {
         if      (aniso >= 16) so->en |= NV40_3D_TEX_ENABLE_ANISO_16X;
         else if (aniso >= 12) so->en |= NV40_3D_TEX_ENABLE_ANISO_12X;
         else if (aniso >= 10) so->en |= NV40_3D_TEX_ENABLE_ANISO_10X;
         else if (aniso >=  8) so->en |= NV40_3D_TEX_ENABLE_ANISO_8X;
         else if (aniso >=  6) so->en |= NV40_3D_TEX_ENABLE_ANISO_6X;
         else if (aniso >=  4) so->en |= NV40_3D_TEX_ENABLE_ANISO_4X;
         else                  so->en |= NV40_3D_TEX_ENABLE_ANISO_2X;

         so->wrap |= nv30_context(pipe)->config.aniso;
      }
   } else {
      so->en |= NV30_3D_TEX_ENABLE_ENABLE;

      if      (cso->max_anisotropy >= 8) so->en |= NV30_3D_TEX_ENABLE_ANISO_8X;
      else if (cso->max_anisotropy >= 4) so->en |= NV30_3D_TEX_ENABLE_ANISO_4X;
      else if (cso->max_anisotropy >= 2) so->en |= NV30_3D_TEX_ENABLE_ANISO_2X;
   }

   so->filt |= (int)(cso->lod_bias * 256.0) & 0x1fff;
   so->max_lod = (int)(CLAMP(cso->max_lod, 0.0, max_lod) * 256.0);
   so->min_lod = (int)(CLAMP(cso->min_lod, 0.0, max_lod) * 256.0);
   return so;
}
Esempio n. 2
0
void mld_group_interface::output_info(base_stream &ctx, bool detailed) const {
	ctx.xprintf("Group-Interface %s [MLD]\n", intf()->name());

	ctx.inc_level();

	int maxsources = 3;
	const address_set &srcs = active_set();

	if (detailed) {
		maxsources = srcs.size();
	}

	ctx.xprintf("Filter: %s ", filter_mode() == include ? "Include" : "Exclude");

	if (srcs.empty()) {
		ctx.write("{}");
	} else {
		ctx.write("{");

		address_set::const_iterator i = srcs.begin();
		ctx.xprintf("%{addr}", *i);
		++i;

		for (int k = 1; k < maxsources && i != srcs.end(); ++i) {
			ctx.xprintf(", %{addr}", *i);
			k++;
		}

		if (i != srcs.end())
			ctx.write(", ...");

		ctx.write(" }");
	}

	if (g_filter_timer.is_running()) {
		ctx.xprintf(" (Reset in %{duration})", g_filter_timer.time_left_d());
	}

	ctx.newl();

	if (detailed) {
		if (!g_sources_timers.empty()) {
			ctx.writeline("Sources:");

			ctx.inc_level();

			std::vector<source_timer>::const_iterator i;

			for (i = g_sources_timers.begin();
					i != g_sources_timers.end(); ++i) {
				ctx.xprintf("%{addr} for %{duration}",
					    i->argument(), i->time_left_d());
			}

			ctx.dec_level();
		}
	}

	output_inner_info(ctx, detailed);

	ctx.dec_level();
}
Esempio n. 3
0
void group_interface::dump_filter(base_stream &os) const {
	os.xprintf("%s %{addrset}",
		   (filter_mode() == include ? "Include" : "Exclude"),
		   (filter_mode() == include ? include_set() : exclude_set()));
}