i915_state_sampler.c revision b70a6babfbc035d64dbe35ac4bf9218e8232b435
1d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell/************************************************************************** 2d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell * 3d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. 4d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell * All Rights Reserved. 5d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell * 6d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell * Permission is hereby granted, free of charge, to any person obtaining a 7d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell * copy of this software and associated documentation files (the 8d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell * "Software"), to deal in the Software without restriction, including 9d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell * without limitation the rights to use, copy, modify, merge, publish, 10d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell * distribute, sub license, and/or sell copies of the Software, and to 11d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell * permit persons to whom the Software is furnished to do so, subject to 12d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell * the following conditions: 13d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell * 14d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell * The above copyright notice and this permission notice (including the 15d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell * next paragraph) shall be included in all copies or substantial portions 16d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell * of the Software. 17d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell * 18d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR 22d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell * 26d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell **************************************************************************/ 27d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell 28d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell#include "pipe/p_context.h" 29d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell#include "pipe/p_state.h" 30be673e9719593ee22c16e289fe4d154db3fb7805Brian#include "pipe/p_util.h" 31d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell 32d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell#include "i915_state_inlines.h" 33d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell#include "i915_context.h" 34d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell#include "i915_reg.h" 35c990d0fd57a05301429b3af75b7fed0337621941Brian#include "i915_state.h" 367e884c6f86621ca07ed31fc7ee3f4d891f0873daBrian 37d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell 38be673e9719593ee22c16e289fe4d154db3fb7805Brian/** 39be673e9719593ee22c16e289fe4d154db3fb7805Brian * Compute i915 texture sampling state. 40be673e9719593ee22c16e289fe4d154db3fb7805Brian * 41be673e9719593ee22c16e289fe4d154db3fb7805Brian * Recalculate all state from scratch. Perhaps not the most 42d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell * efficient, but this has gotten complex enough that we need 43d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell * something which is understandable and reliable. 44be673e9719593ee22c16e289fe4d154db3fb7805Brian * \param state returns the 3 words of compute state 45d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell */ 46be673e9719593ee22c16e289fe4d154db3fb7805Brianstatic void update_sampler(struct i915_context *i915, 47be673e9719593ee22c16e289fe4d154db3fb7805Brian uint unit, 48742e32a40bf5ef1bd90b23aa0f7d451b7b7f0ba3Zack Rusin const struct i915_sampler_state *sampler, 49753db0d8407147393a7b0622ae3fa28f68d0353dMichel Dänzer const struct i915_texture *tex, 50be673e9719593ee22c16e289fe4d154db3fb7805Brian unsigned state[3] ) 51d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell{ 52753db0d8407147393a7b0622ae3fa28f68d0353dMichel Dänzer const struct pipe_texture *pt = &tex->base; 53753db0d8407147393a7b0622ae3fa28f68d0353dMichel Dänzer 54d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell /* Need to do this after updating the maps, which call the 55d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell * intel_finalize_mipmap_tree and hence can update firstLevel: 56d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell */ 57742e32a40bf5ef1bd90b23aa0f7d451b7b7f0ba3Zack Rusin state[0] = sampler->state[0]; 58742e32a40bf5ef1bd90b23aa0f7d451b7b7f0ba3Zack Rusin state[1] = sampler->state[1]; 59742e32a40bf5ef1bd90b23aa0f7d451b7b7f0ba3Zack Rusin state[2] = sampler->state[2]; 60d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell 61753db0d8407147393a7b0622ae3fa28f68d0353dMichel Dänzer if (pt->format == PIPE_FORMAT_YCBCR || 62753db0d8407147393a7b0622ae3fa28f68d0353dMichel Dänzer pt->format == PIPE_FORMAT_YCBCR_REV) 63d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell state[0] |= SS2_COLORSPACE_CONVERSION; 64d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell 65be673e9719593ee22c16e289fe4d154db3fb7805Brian /* 3D textures don't seem to respect the border color. 66be673e9719593ee22c16e289fe4d154db3fb7805Brian * Fallback if there's ever a danger that they might refer to 67be673e9719593ee22c16e289fe4d154db3fb7805Brian * it. 68be673e9719593ee22c16e289fe4d154db3fb7805Brian * 69be673e9719593ee22c16e289fe4d154db3fb7805Brian * Effectively this means fallback on 3D clamp or 70be673e9719593ee22c16e289fe4d154db3fb7805Brian * clamp_to_border. 71be673e9719593ee22c16e289fe4d154db3fb7805Brian * 72be673e9719593ee22c16e289fe4d154db3fb7805Brian * XXX: Check if this is true on i945. 73be673e9719593ee22c16e289fe4d154db3fb7805Brian * XXX: Check if this bug got fixed in release silicon. 74be673e9719593ee22c16e289fe4d154db3fb7805Brian */ 75be673e9719593ee22c16e289fe4d154db3fb7805Brian#if 0 76742e32a40bf5ef1bd90b23aa0f7d451b7b7f0ba3Zack Rusin { 77742e32a40bf5ef1bd90b23aa0f7d451b7b7f0ba3Zack Rusin const unsigned ws = sampler->templ->wrap_s; 78742e32a40bf5ef1bd90b23aa0f7d451b7b7f0ba3Zack Rusin const unsigned wt = sampler->templ->wrap_t; 79742e32a40bf5ef1bd90b23aa0f7d451b7b7f0ba3Zack Rusin const unsigned wr = sampler->templ->wrap_r; 80753db0d8407147393a7b0622ae3fa28f68d0353dMichel Dänzer if (pt->target == PIPE_TEXTURE_3D && 81742e32a40bf5ef1bd90b23aa0f7d451b7b7f0ba3Zack Rusin (sampler->templ->min_img_filter != PIPE_TEX_FILTER_NEAREST || 82742e32a40bf5ef1bd90b23aa0f7d451b7b7f0ba3Zack Rusin sampler->templ->mag_img_filter != PIPE_TEX_FILTER_NEAREST) && 83742e32a40bf5ef1bd90b23aa0f7d451b7b7f0ba3Zack Rusin (ws == PIPE_TEX_WRAP_CLAMP || 84742e32a40bf5ef1bd90b23aa0f7d451b7b7f0ba3Zack Rusin wt == PIPE_TEX_WRAP_CLAMP || 85742e32a40bf5ef1bd90b23aa0f7d451b7b7f0ba3Zack Rusin wr == PIPE_TEX_WRAP_CLAMP || 86742e32a40bf5ef1bd90b23aa0f7d451b7b7f0ba3Zack Rusin ws == PIPE_TEX_WRAP_CLAMP_TO_BORDER || 87742e32a40bf5ef1bd90b23aa0f7d451b7b7f0ba3Zack Rusin wt == PIPE_TEX_WRAP_CLAMP_TO_BORDER || 88742e32a40bf5ef1bd90b23aa0f7d451b7b7f0ba3Zack Rusin wr == PIPE_TEX_WRAP_CLAMP_TO_BORDER)) { 89742e32a40bf5ef1bd90b23aa0f7d451b7b7f0ba3Zack Rusin if (i915->strict_conformance) { 90742e32a40bf5ef1bd90b23aa0f7d451b7b7f0ba3Zack Rusin assert(0); 91742e32a40bf5ef1bd90b23aa0f7d451b7b7f0ba3Zack Rusin /* sampler->fallback = true; */ 92742e32a40bf5ef1bd90b23aa0f7d451b7b7f0ba3Zack Rusin /* TODO */ 93742e32a40bf5ef1bd90b23aa0f7d451b7b7f0ba3Zack Rusin } 94d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell } 95be673e9719593ee22c16e289fe4d154db3fb7805Brian } 96742e32a40bf5ef1bd90b23aa0f7d451b7b7f0ba3Zack Rusin#endif 97d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell 98742e32a40bf5ef1bd90b23aa0f7d451b7b7f0ba3Zack Rusin state[1] |= (unit << SS3_TEXTUREMAP_INDEX_SHIFT); 99d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell} 100d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell 101237429aa3b8c2025e11aaa23d04e7107cf6a838fBrian 102d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwellvoid i915_update_samplers( struct i915_context *i915 ) 103d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell{ 104be673e9719593ee22c16e289fe4d154db3fb7805Brian uint unit; 105be673e9719593ee22c16e289fe4d154db3fb7805Brian 106be673e9719593ee22c16e289fe4d154db3fb7805Brian i915->current.sampler_enable_nr = 0; 107be673e9719593ee22c16e289fe4d154db3fb7805Brian i915->current.sampler_enable_flags = 0x0; 108be673e9719593ee22c16e289fe4d154db3fb7805Brian 1094528287e040415c2071012d02f20979ff995c754Keith Whitwell for (unit = 0; unit < i915->num_textures && unit < i915->num_samplers; 1104528287e040415c2071012d02f20979ff995c754Keith Whitwell unit++) { 111753db0d8407147393a7b0622ae3fa28f68d0353dMichel Dänzer /* determine unit enable/disable by looking for a bound texture */ 112be673e9719593ee22c16e289fe4d154db3fb7805Brian /* could also examine the fragment program? */ 113be673e9719593ee22c16e289fe4d154db3fb7805Brian if (i915->texture[unit]) { 114be673e9719593ee22c16e289fe4d154db3fb7805Brian update_sampler( i915, 115be673e9719593ee22c16e289fe4d154db3fb7805Brian unit, 116f117327a3f246713abfd4dc4320d4a1a7f1b811aZack Rusin i915->sampler[unit], /* sampler state */ 117753db0d8407147393a7b0622ae3fa28f68d0353dMichel Dänzer i915->texture[unit], /* texture */ 118be673e9719593ee22c16e289fe4d154db3fb7805Brian i915->current.sampler[unit] /* the result */ 119be673e9719593ee22c16e289fe4d154db3fb7805Brian ); 120be673e9719593ee22c16e289fe4d154db3fb7805Brian 121be673e9719593ee22c16e289fe4d154db3fb7805Brian i915->current.sampler_enable_nr++; 122be673e9719593ee22c16e289fe4d154db3fb7805Brian i915->current.sampler_enable_flags |= (1 << unit); 123d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell } 124d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell } 125d1fbf621dc48a488c0f860c5851332d269e6d637Keith Whitwell 126be673e9719593ee22c16e289fe4d154db3fb7805Brian i915->hardware_dirty |= I915_HW_SAMPLER; 127be673e9719593ee22c16e289fe4d154db3fb7805Brian} 128c990d0fd57a05301429b3af75b7fed0337621941Brian 129c990d0fd57a05301429b3af75b7fed0337621941Brian 130c990d0fd57a05301429b3af75b7fed0337621941Brianstatic uint 13154fc80ab31f89520d3119196bfa9c6332b35fe2fBriantranslate_texture_format(enum pipe_format pipeFormat) 132c990d0fd57a05301429b3af75b7fed0337621941Brian{ 133c990d0fd57a05301429b3af75b7fed0337621941Brian switch (pipeFormat) { 134c990d0fd57a05301429b3af75b7fed0337621941Brian case PIPE_FORMAT_U_L8: 135c990d0fd57a05301429b3af75b7fed0337621941Brian return MAPSURF_8BIT | MT_8BIT_L8; 136c990d0fd57a05301429b3af75b7fed0337621941Brian case PIPE_FORMAT_U_I8: 137c990d0fd57a05301429b3af75b7fed0337621941Brian return MAPSURF_8BIT | MT_8BIT_I8; 138c990d0fd57a05301429b3af75b7fed0337621941Brian case PIPE_FORMAT_U_A8: 139c990d0fd57a05301429b3af75b7fed0337621941Brian return MAPSURF_8BIT | MT_8BIT_A8; 14059e7bfa1de77ab03ca174bdf82fe33ab36050ce7Brian case PIPE_FORMAT_U_A8_L8: 141c990d0fd57a05301429b3af75b7fed0337621941Brian return MAPSURF_16BIT | MT_16BIT_AY88; 1422067eed9d30bb5b260920a5650655579c1988202Brian case PIPE_FORMAT_R5G6B5_UNORM: 143c990d0fd57a05301429b3af75b7fed0337621941Brian return MAPSURF_16BIT | MT_16BIT_RGB565; 1442067eed9d30bb5b260920a5650655579c1988202Brian case PIPE_FORMAT_A1R5G5B5_UNORM: 145c990d0fd57a05301429b3af75b7fed0337621941Brian return MAPSURF_16BIT | MT_16BIT_ARGB1555; 1462067eed9d30bb5b260920a5650655579c1988202Brian case PIPE_FORMAT_A4R4G4B4_UNORM: 147c990d0fd57a05301429b3af75b7fed0337621941Brian return MAPSURF_16BIT | MT_16BIT_ARGB4444; 1482067eed9d30bb5b260920a5650655579c1988202Brian case PIPE_FORMAT_A8R8G8B8_UNORM: 149c990d0fd57a05301429b3af75b7fed0337621941Brian return MAPSURF_32BIT | MT_32BIT_ARGB8888; 150c990d0fd57a05301429b3af75b7fed0337621941Brian case PIPE_FORMAT_YCBCR_REV: 151c990d0fd57a05301429b3af75b7fed0337621941Brian return (MAPSURF_422 | MT_422_YCRCB_NORMAL); 152c990d0fd57a05301429b3af75b7fed0337621941Brian case PIPE_FORMAT_YCBCR: 153c990d0fd57a05301429b3af75b7fed0337621941Brian return (MAPSURF_422 | MT_422_YCRCB_SWAPY); 154c990d0fd57a05301429b3af75b7fed0337621941Brian#if 0 155c990d0fd57a05301429b3af75b7fed0337621941Brian case PIPE_FORMAT_RGB_FXT1: 156c990d0fd57a05301429b3af75b7fed0337621941Brian case PIPE_FORMAT_RGBA_FXT1: 157c990d0fd57a05301429b3af75b7fed0337621941Brian return (MAPSURF_COMPRESSED | MT_COMPRESS_FXT1); 158c990d0fd57a05301429b3af75b7fed0337621941Brian#endif 1592067eed9d30bb5b260920a5650655579c1988202Brian case PIPE_FORMAT_Z16_UNORM: 160c990d0fd57a05301429b3af75b7fed0337621941Brian return (MAPSURF_16BIT | MT_16BIT_L16); 161c990d0fd57a05301429b3af75b7fed0337621941Brian#if 0 162c990d0fd57a05301429b3af75b7fed0337621941Brian case PIPE_FORMAT_RGBA_DXT1: 163c990d0fd57a05301429b3af75b7fed0337621941Brian case PIPE_FORMAT_RGB_DXT1: 164c990d0fd57a05301429b3af75b7fed0337621941Brian return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT1); 165c990d0fd57a05301429b3af75b7fed0337621941Brian case PIPE_FORMAT_RGBA_DXT3: 166c990d0fd57a05301429b3af75b7fed0337621941Brian return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT2_3); 167c990d0fd57a05301429b3af75b7fed0337621941Brian case PIPE_FORMAT_RGBA_DXT5: 168c990d0fd57a05301429b3af75b7fed0337621941Brian return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT4_5); 169c990d0fd57a05301429b3af75b7fed0337621941Brian#endif 1702067eed9d30bb5b260920a5650655579c1988202Brian case PIPE_FORMAT_S8Z24_UNORM: 171c990d0fd57a05301429b3af75b7fed0337621941Brian return (MAPSURF_32BIT | MT_32BIT_xL824); 172c990d0fd57a05301429b3af75b7fed0337621941Brian default: 1739791d7f64c5a58b9c1bf32d00c71e0e031f54f70José Fonseca debug_printf("i915: translate_texture_format() bad image format %x\n", 174c990d0fd57a05301429b3af75b7fed0337621941Brian pipeFormat); 175c990d0fd57a05301429b3af75b7fed0337621941Brian assert(0); 176c990d0fd57a05301429b3af75b7fed0337621941Brian return 0; 177c990d0fd57a05301429b3af75b7fed0337621941Brian } 178c990d0fd57a05301429b3af75b7fed0337621941Brian} 179c990d0fd57a05301429b3af75b7fed0337621941Brian 180c990d0fd57a05301429b3af75b7fed0337621941Brian 181c990d0fd57a05301429b3af75b7fed0337621941Brianstatic void 182c990d0fd57a05301429b3af75b7fed0337621941Briani915_update_texture(struct i915_context *i915, uint unit, 183c990d0fd57a05301429b3af75b7fed0337621941Brian uint state[6]) 184c990d0fd57a05301429b3af75b7fed0337621941Brian{ 185753db0d8407147393a7b0622ae3fa28f68d0353dMichel Dänzer const struct i915_texture *tex = i915->texture[unit]; 186753db0d8407147393a7b0622ae3fa28f68d0353dMichel Dänzer const struct pipe_texture *pt = &tex->base; 187c990d0fd57a05301429b3af75b7fed0337621941Brian uint format, pitch; 188753db0d8407147393a7b0622ae3fa28f68d0353dMichel Dänzer const uint width = pt->width[0], height = pt->height[0], depth = pt->depth[0]; 1894da1cdf78fa3b954840650fa46cf72da5daf149fBrian const uint num_levels = pt->last_level; 190c990d0fd57a05301429b3af75b7fed0337621941Brian 191753db0d8407147393a7b0622ae3fa28f68d0353dMichel Dänzer assert(tex); 192c990d0fd57a05301429b3af75b7fed0337621941Brian assert(width); 193c990d0fd57a05301429b3af75b7fed0337621941Brian assert(height); 194c990d0fd57a05301429b3af75b7fed0337621941Brian assert(depth); 195c990d0fd57a05301429b3af75b7fed0337621941Brian 196753db0d8407147393a7b0622ae3fa28f68d0353dMichel Dänzer format = translate_texture_format(pt->format); 197753db0d8407147393a7b0622ae3fa28f68d0353dMichel Dänzer pitch = tex->pitch * pt->cpp; 198c990d0fd57a05301429b3af75b7fed0337621941Brian 199c990d0fd57a05301429b3af75b7fed0337621941Brian assert(format); 200c990d0fd57a05301429b3af75b7fed0337621941Brian assert(pitch); 201c990d0fd57a05301429b3af75b7fed0337621941Brian 202c990d0fd57a05301429b3af75b7fed0337621941Brian /* MS3 state */ 203c990d0fd57a05301429b3af75b7fed0337621941Brian state[0] = 204c990d0fd57a05301429b3af75b7fed0337621941Brian (((height - 1) << MS3_HEIGHT_SHIFT) 205c990d0fd57a05301429b3af75b7fed0337621941Brian | ((width - 1) << MS3_WIDTH_SHIFT) 206c990d0fd57a05301429b3af75b7fed0337621941Brian | format 207c990d0fd57a05301429b3af75b7fed0337621941Brian | MS3_USE_FENCE_REGS); 208c990d0fd57a05301429b3af75b7fed0337621941Brian 209b70a6babfbc035d64dbe35ac4bf9218e8232b435Brian /* 210b70a6babfbc035d64dbe35ac4bf9218e8232b435Brian * XXX sampler->max_lod should be used to program the MAX_LOD field below. 211b70a6babfbc035d64dbe35ac4bf9218e8232b435Brian * Also, when min_filter != mag_filter and there's just one mipmap level, 212b70a6babfbc035d64dbe35ac4bf9218e8232b435Brian * set max_lod = 1 to make sure i915 chooses between min/mag filtering. 213b70a6babfbc035d64dbe35ac4bf9218e8232b435Brian */ 214b70a6babfbc035d64dbe35ac4bf9218e8232b435Brian 215c990d0fd57a05301429b3af75b7fed0337621941Brian /* MS4 state */ 216c990d0fd57a05301429b3af75b7fed0337621941Brian state[1] = 217c990d0fd57a05301429b3af75b7fed0337621941Brian ((((pitch / 4) - 1) << MS4_PITCH_SHIFT) 218c990d0fd57a05301429b3af75b7fed0337621941Brian | MS4_CUBE_FACE_ENA_MASK 219c990d0fd57a05301429b3af75b7fed0337621941Brian | ((num_levels * 4) << MS4_MAX_LOD_SHIFT) 220c990d0fd57a05301429b3af75b7fed0337621941Brian | ((depth - 1) << MS4_VOLUME_DEPTH_SHIFT)); 221c990d0fd57a05301429b3af75b7fed0337621941Brian} 222c990d0fd57a05301429b3af75b7fed0337621941Brian 223c990d0fd57a05301429b3af75b7fed0337621941Brian 224c990d0fd57a05301429b3af75b7fed0337621941Brianvoid 225c990d0fd57a05301429b3af75b7fed0337621941Briani915_update_textures(struct i915_context *i915) 226c990d0fd57a05301429b3af75b7fed0337621941Brian{ 227c990d0fd57a05301429b3af75b7fed0337621941Brian uint unit; 228c990d0fd57a05301429b3af75b7fed0337621941Brian 2294528287e040415c2071012d02f20979ff995c754Keith Whitwell for (unit = 0; unit < i915->num_textures && unit < i915->num_samplers; 2304528287e040415c2071012d02f20979ff995c754Keith Whitwell unit++) { 231753db0d8407147393a7b0622ae3fa28f68d0353dMichel Dänzer /* determine unit enable/disable by looking for a bound texture */ 232c990d0fd57a05301429b3af75b7fed0337621941Brian /* could also examine the fragment program? */ 233c990d0fd57a05301429b3af75b7fed0337621941Brian if (i915->texture[unit]) { 234c990d0fd57a05301429b3af75b7fed0337621941Brian i915_update_texture(i915, unit, i915->current.texbuffer[unit]); 235c990d0fd57a05301429b3af75b7fed0337621941Brian } 236c990d0fd57a05301429b3af75b7fed0337621941Brian } 237c990d0fd57a05301429b3af75b7fed0337621941Brian 238c990d0fd57a05301429b3af75b7fed0337621941Brian i915->hardware_dirty |= I915_HW_MAP; 239c990d0fd57a05301429b3af75b7fed0337621941Brian} 240