提供讀取和寫入對紋理的存取。
texture_view 只能用來讀取值類型為 int、unsigned int 或 float,且預設為32位的紋理。 若要讀取其他紋理格式,請使用 texture_view<const value_type, _Rank>。
語法
template<typename value_type,int _Rank>
class texture_view;
template<typename value_type, int _Rank>
class texture_view
: public details::_Texture_base<value_type, _Rank>;
template<typename value_type, int _Rank>
class texture_view<const value_type, _Rank>
: public details::_Texture_base<value_type, _Rank>;
參數
value_type
紋理匯總中的項目類型。
_排行
texture_view 的排名。
成員
公共型別定義
| 名稱 | 描述 |
|---|---|
value_type |
紋理聚合中的元素類型。 |
coordinates_type |
用來在texture_view中指定紋素的座標類型是short_vector,即與相關聯的紋理具有相同維度並具有實值類型的float。 |
gather_return_type |
用於收集操作的回傳類型是階層 4 short_vector,它儲存從取樣的四個紋素值中收集的四個同質色彩元件。 |
公開建構函式
| 名稱 | 描述 |
|---|---|
| texture_view建構函式 | 超載 建構texture_view實例。 |
| ~ texture_view 解構函式 |
texture_view銷毀實例。 |
公用方法
| 名稱 | 描述 |
|---|---|
| gather_alpha | 超載 使用指定的取樣組態來取樣指定座標上的紋理,並傳回四個取樣紋素的Alpha (w) 元件。 |
| gather_blue | 超載 使用指定的取樣組態來取樣指定座標上的紋理,並傳回四個取樣紋素的藍色 (z) 元件。 |
| gather_green | 超載 使用指定的取樣組態來取樣指定座標上的紋理,並傳回四個取樣紋素的綠色 (y) 元件。 |
| gather_red | 超載 使用指定的取樣組態來對指定座標上的紋理進行取樣,並回傳四個取樣點的紅色(x)分量。 |
| 獲取 | 超載 依索引取得元素值。 |
| 樣本 | 超載 使用指定的取樣配置,在指定的座標和細節層級取樣紋理。 |
| 設定 | 根據索引設定元素的值。 |
公用運算子
| 名稱 | 描述 |
|---|---|
| operator() | 超載 依索引取得元素值。 |
| operator[] | 超載 依索引取得元素值。 |
| 運算子= | 超載 賦值運算子。 |
公用資料成員
| 名稱 | 描述 |
|---|---|
| value_type | 元素的值類型 texture_view。 |
繼承階層架構
_Texture_base
texture_view
需求
標頭: amp_graphics.h
命名空間: concurrency::graphics
~texture_view
texture_view銷毀實例。
~texture_view() restrict(amp, cpu);
texture_view
建構texture_view實例。
texture_view(// [1] constructor
texture<value_type, _Rank>& _Src) restrict(amp);
texture_view(// [2] constructor
texture<value_type, _Rank>& _Src,
unsigned int _Mipmap_level = 0) restrict(cpu);
texture_view(// [3] constructor
const texture<value_type, _Rank>& _Src) restrict(amp);
texture_view(// [4] constructor
const texture<value_type, _Rank>& _Src,
unsigned int _Most_detailed_mip,
unsigned int _Mip_levels) restrict(cpu);
texture_view(// [5] copy constructor
const texture_view<value_type, _Rank>& _Other) restrict(amp, cpu);
texture_view(// [6] copy constructor
const texture_view<const value_type, _Rank>& _Other) restrict(amp, cpu);
texture_view(// [7] copy constructor
const texture_view<const value_type, _Rank>& _Other,
unsigned int _Most_detailed_mip,
unsigned int _Mip_levels) restrict(cpu);
參數
_Src
[1, 2] 在 texture 中建立可寫入的 texture_view 的建構函式。
[3, 4] 用於建立非寫入的 texture_view 的 texture 建構函式。
_其他
[5] 複製建構函式 來源可 texture_view寫入 。
[6, 7]複製建構函式 來源無法寫入 texture_view。
_Mipmap_level
與此texture_view可寫入結合的來源texture的特定 Mipmap 層級。 默認值為 0,代表最上層(最詳細)mip 層級。
_Most_detailed_mip
相對於指定的 texture_view 物件,檢視的最上層 (最詳細) mip 層級。
_Mip_levels
可透過 texture_view存取的Mipmap層級數目。
gather_red
使用指定的取樣組態來對指定座標上的紋理進行取樣,並回傳四個取樣點的紅色(x)分量。
const gather_return_type gather_red(
const sampler& _Sampler,
const coordinates_type& _Coord) const restrict(amp);
template<
address_mode _Address_mode = address_clamp
>
const gather_return_type gather_red(
const coordinates_type& _Coord) const restrict(amp);
參數
_位址模式
用於取樣的texture_view位址模式。 所有維度的位址模式都相同。
_Sampler
用來取樣的 texture_view取樣器組態。
_Coord
取得樣本的座標。 小數座標值可用來在樣本紋理單位之間進行插值。
傳回值
階數為 4 的短向量,其中包含 4 個取樣的紋素值的紅色(x)分量。
gather_green
使用指定的取樣組態來取樣指定座標上的紋理,並傳回四個取樣紋素的綠色 (y) 元件。
const gather_return_type gather_green(
const sampler& _Sampler,
const coordinates_type& _Coord) const restrict(amp);
template<
address_mode _Address_mode = address_clamp
>
const gather_return_type gather_green(
const coordinates_type& _Coord) const restrict(amp);
參數
_位址模式
用於取樣的texture_view位址模式。 所有維度的位址模式都相同。
_Sampler
用來取樣的 texture_view取樣器組態。
_Coord
取得樣本的座標。 小數座標值可用來在樣本紋理單位之間進行插值。
傳回值
等級 4 的四維短向量,包含取樣的 4 個紋素值中的綠色 y 元件。
gather_blue
使用指定的取樣組態來取樣指定座標上的紋理,並傳回四個取樣紋素的藍色 (z) 元件。
const gather_return_type gather_blue(
const sampler& _Sampler,
const coordinates_type& _Coord) const restrict(amp);
template<
address_mode _Address_mode = address_clamp
>
const gather_return_type gather_blue(
const coordinates_type& _Coord) const restrict(amp);
參數
_位址模式
用於取樣的texture_view位址模式。 所有維度的位址模式都相同。
_Sampler
用來取樣的 texture_view取樣器組態。
_Coord
取得樣本的座標。 小數座標值可用來在樣本紋理單位之間進行插值。
傳回值
四階短向量,其中包含 4 個採樣的紋素值的紅色 (x) 分量。
gather_alpha
使用指定的取樣組態來取樣指定座標上的紋理,並傳回四個取樣紋素的Alpha (w) 元件。
const gather_return_type gather_alpha(
const sampler& _Sampler,
const coordinates_type& _Coord) const restrict(amp);
template<
address_mode _Address_mode = address_clamp
>
const gather_return_type gather_alpha(
const coordinates_type& _Coord) const restrict(amp);
參數
_位址模式
用於取樣的texture_view位址模式。 所有維度的位址模式都相同。
_Sampler
用來取樣的 texture_view取樣器組態。
_Coord
取得樣本的座標。 小數座標值可用來在樣本紋理單位之間進行插值。
傳回值
四階短向量,其中包含 4 個取樣紋素值的 Alpha (w) 元件。
get
取得位於指定索引處的元素值。
const value_type get(
const index<_Rank>& _Index) const restrict(amp);
value_type get(
const index<_Rank>& _Index,
unsigned int _Mip_level = 0) const restrict(amp);
參數
_指數
要獲取的元素之索引,可能是多維的。
_Mip_level
應該從中取得值的 mipmap 層級。 預設值 0 代表最詳細的 Mipmap 層級。
傳回值
元素的值。
運算子=
指派與指定的texture_view相同紋理的視圖到這個texture_view實例。
texture_view<value_type, _Rank>& operator= (// [1] copy constructor
const texture_view<value_type, _Rank>& _Other) restrict(amp, cpu);
texture_view<const value_type, _Rank>& operator= (// [2] copy constructor
const texture_view<value_type, _Rank>& _Other) restrict(cpu);
texture_view<const value_type, _Rank>& operator= (// [3] copy constructor
const texture_view<const value_type, _Rank>& _Other) restrict(amp, cpu);
參數
_其他
[1, 2] 複製建構子 可寫入 texture_view 的物件。
[3] 複製建構函式 不可寫入 texture_view 的物件。
傳回值
該 texture_view 實例的引用。
運算子[] (operator[])
依索引傳回元素值。
const value_type operator[] (const index<_Rank>& _Index) const restrict(amp);
const value_type operator[] (int _I0) const restrict(amp);
value_type operator[] (const index<_Rank>& _Index) const restrict(amp);
value_type operator[] (int _I0) const restrict(amp);
參數
_指數
索引可能是多維的。
_I0
一維索引。
傳回值
_Index所索引的元素值。
operator()
根據索引傳回元素值。
const value_type operator() (
const index<_Rank>& _Index) const restrict(amp);
const value_type operator() (
int _I0) const restrict(amp);
const value_type operator() (
int _I0, int _I1) const restrict(amp);
const value_type operator() (
int _I0,
int _I1,
int _I2) const restrict(amp);
value_type operator() (
const index<_Rank>& _Index) const restrict(amp);
value_type operator() (
int _I0) const restrict(amp);
value_type operator() (
int _I0,
int _I1) const restrict(amp);
value_type operator() (
int _I0,
int _I1,
int _I2) const restrict(amp);
參數
_指數
索引,可能是多維度。
_I0
索引最重要的元件。
_I1
索引的下一個至最重要元件。
_I2
索引最不重要的元件。
傳回值
由 _Index 編製索引的元素值。
樣本
使用指定的取樣配置,在指定的座標和細節層級取樣紋理。
value_type sample(
const sampler& _Sampler,
const coordinates_type& _Coord,
float _Level_of_detail = 0.0f) const restrict(amp);
template<
filter_mode _Filter_mode = filter_linear,
address_mode _Address_mode = address_clamp
>
value_type sample(
const coordinates_type& _Coord,
float _Level_of_detail = 0.0f) const restrict(amp);
參數
_Filter_mode
用於取樣紋理視圖的過濾模式。 針對最小化、最大化和 mipmap 篩選條件,篩選模式相同。
_位址模式
用來取樣 texture_view 的地址模式。 所有維度的位址模式都相同。
_Sampler
用來取樣texture_view的取樣器組態。
_Coord
取得樣本的座標。 小數座標值可用來插補紋素值。
_細節層次
值會指定要從中取樣的Mipmap層級。 小數值可用來插補兩個Mipmap層級。 詳細數據的預設層級為 0,代表最詳細的 Mip 層級。
傳回值
插入的範例值。
設定
將位於指定索引處的項目值設定為指定的值。
void set(
const index<_Rank>& _Index,
const value_type& value) const restrict(amp);
參數
_指數
要設定的元素的索引,可能是多重維度。
價值
要設定元素的值。
value_type(值類型)
texture_view項目的實值型別。
typedef typename const value_type value_type;