Lines Matching refs:so
132 struct nv30_sampler_state *so; in nv30_sampler_state_create() local
135 so = MALLOC_STRUCT(nv30_sampler_state); in nv30_sampler_state_create()
136 if (!so) in nv30_sampler_state_create()
139 so->pipe = *cso; in nv30_sampler_state_create()
140 so->fmt = 0; in nv30_sampler_state_create()
141 so->wrap = (wrap_mode(cso->wrap_s) << NV30_3D_TEX_WRAP_S__SHIFT) | in nv30_sampler_state_create()
144 so->en = 0; in nv30_sampler_state_create()
145 so->wrap |= compare_mode(cso); in nv30_sampler_state_create()
146 so->filt = filter_mode(cso) | 0x00002000; in nv30_sampler_state_create()
147 so->bcol = (float_to_ubyte(cso->border_color.f[3]) << 24) | in nv30_sampler_state_create()
156 so->fmt |= NV40_3D_TEX_FORMAT_RECT; in nv30_sampler_state_create()
159 if (aniso >= 16) so->en |= NV40_3D_TEX_ENABLE_ANISO_16X; in nv30_sampler_state_create()
160 else if (aniso >= 12) so->en |= NV40_3D_TEX_ENABLE_ANISO_12X; in nv30_sampler_state_create()
161 else if (aniso >= 10) so->en |= NV40_3D_TEX_ENABLE_ANISO_10X; in nv30_sampler_state_create()
162 else if (aniso >= 8) so->en |= NV40_3D_TEX_ENABLE_ANISO_8X; in nv30_sampler_state_create()
163 else if (aniso >= 6) so->en |= NV40_3D_TEX_ENABLE_ANISO_6X; in nv30_sampler_state_create()
164 else if (aniso >= 4) so->en |= NV40_3D_TEX_ENABLE_ANISO_4X; in nv30_sampler_state_create()
165 else so->en |= NV40_3D_TEX_ENABLE_ANISO_2X; in nv30_sampler_state_create()
167 so->wrap |= nv30_context(pipe)->config.aniso; in nv30_sampler_state_create()
170 so->en |= NV30_3D_TEX_ENABLE_ENABLE; in nv30_sampler_state_create()
172 if (cso->max_anisotropy >= 8) so->en |= NV30_3D_TEX_ENABLE_ANISO_8X; in nv30_sampler_state_create()
173 else if (cso->max_anisotropy >= 4) so->en |= NV30_3D_TEX_ENABLE_ANISO_4X; in nv30_sampler_state_create()
174 else if (cso->max_anisotropy >= 2) so->en |= NV30_3D_TEX_ENABLE_ANISO_2X; in nv30_sampler_state_create()
177 so->filt |= (int)(cso->lod_bias * 256.0) & 0x1fff; in nv30_sampler_state_create()
178 so->max_lod = (int)(CLAMP(cso->max_lod, 0.0, max_lod) * 256.0); in nv30_sampler_state_create()
179 so->min_lod = (int)(CLAMP(cso->min_lod, 0.0, max_lod) * 256.0); in nv30_sampler_state_create()
180 return so; in nv30_sampler_state_create()
207 struct nv30_sampler_view *so; in nv30_sampler_view_create() local
209 so = MALLOC_STRUCT(nv30_sampler_view); in nv30_sampler_view_create()
210 if (!so) in nv30_sampler_view_create()
212 so->pipe = *tmpl; in nv30_sampler_view_create()
213 so->pipe.reference.count = 1; in nv30_sampler_view_create()
214 so->pipe.texture = NULL; in nv30_sampler_view_create()
215 so->pipe.context = pipe; in nv30_sampler_view_create()
216 pipe_resource_reference(&so->pipe.texture, pt); in nv30_sampler_view_create()
218 so->fmt = NV30_3D_TEX_FORMAT_NO_BORDER; in nv30_sampler_view_create()
221 so->fmt |= NV30_3D_TEX_FORMAT_DIMS_1D; in nv30_sampler_view_create()
224 so->fmt |= NV30_3D_TEX_FORMAT_CUBIC; in nv30_sampler_view_create()
227 so->fmt |= NV30_3D_TEX_FORMAT_DIMS_2D; in nv30_sampler_view_create()
230 so->fmt |= NV30_3D_TEX_FORMAT_DIMS_3D; in nv30_sampler_view_create()
234 so->fmt |= NV30_3D_TEX_FORMAT_DIMS_1D; in nv30_sampler_view_create()
238 so->filt = fmt->filter; in nv30_sampler_view_create()
239 so->wrap = fmt->wrap; in nv30_sampler_view_create()
240 so->swz = fmt->swizzle; in nv30_sampler_view_create()
241 so->swz |= swizzle(fmt, 3, tmpl->swizzle_a); in nv30_sampler_view_create()
242 so->swz |= swizzle(fmt, 0, tmpl->swizzle_r) << 2; in nv30_sampler_view_create()
243 so->swz |= swizzle(fmt, 1, tmpl->swizzle_g) << 4; in nv30_sampler_view_create()
244 so->swz |= swizzle(fmt, 2, tmpl->swizzle_b) << 6; in nv30_sampler_view_create()
249 so->wrap_mask = ~0; in nv30_sampler_view_create()
251 so->wrap_mask &= ~NV30_3D_TEX_WRAP_T__MASK; in nv30_sampler_view_create()
252 so->wrap |= NV30_3D_TEX_WRAP_T_REPEAT; in nv30_sampler_view_create()
259 so->filt_mask = ~(NV30_3D_TEX_FILTER_MIN__MASK | in nv30_sampler_view_create()
261 so->filt |= NV30_3D_TEX_FILTER_MIN_NEAREST | in nv30_sampler_view_create()
265 so->filt_mask = ~0; in nv30_sampler_view_create()
269 so->npot_size0 = (pt->width0 << 16) | pt->height0; in nv30_sampler_view_create()
271 so->npot_size1 = (pt->depth0 << 20) | mt->uniform_pitch; in nv30_sampler_view_create()
273 so->fmt |= NV40_3D_TEX_FORMAT_LINEAR; in nv30_sampler_view_create()
274 so->fmt |= 0x00008000; in nv30_sampler_view_create()
275 so->fmt |= (pt->last_level + 1) << NV40_3D_TEX_FORMAT_MIPMAP_COUNT__SHIFT; in nv30_sampler_view_create()
277 so->swz |= mt->uniform_pitch << NV30_3D_TEX_SWIZZLE_RECT_PITCH__SHIFT; in nv30_sampler_view_create()
279 so->fmt |= NV30_3D_TEX_FORMAT_MIPMAP; in nv30_sampler_view_create()
280 so->fmt |= util_logbase2(pt->width0) << 20; in nv30_sampler_view_create()
281 so->fmt |= util_logbase2(pt->height0) << 24; in nv30_sampler_view_create()
282 so->fmt |= util_logbase2(pt->depth0) << 28; in nv30_sampler_view_create()
283 so->fmt |= 0x00010000; in nv30_sampler_view_create()
286 so->base_lod = so->pipe.u.tex.first_level << 8; in nv30_sampler_view_create()
287 so->high_lod = MIN2(pt->last_level, so->pipe.u.tex.last_level) << 8; in nv30_sampler_view_create()
288 return &so->pipe; in nv30_sampler_view_create()