ShaderConfig.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691
  1. using Ryujinx.Graphics.Shader.IntermediateRepresentation;
  2. using Ryujinx.Graphics.Shader.StructuredIr;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Numerics;
  7. namespace Ryujinx.Graphics.Shader.Translation
  8. {
  9. class ShaderConfig
  10. {
  11. // TODO: Non-hardcoded array size.
  12. public const int SamplerArraySize = 4;
  13. private const int ThreadsPerWarp = 32;
  14. public ShaderStage Stage { get; }
  15. public bool GpPassthrough { get; }
  16. public bool LastInVertexPipeline { get; private set; }
  17. public int ThreadsPerInputPrimitive { get; }
  18. public OutputTopology OutputTopology { get; }
  19. public int MaxOutputVertices { get; }
  20. public int LocalMemorySize { get; }
  21. public ImapPixelType[] ImapTypes { get; }
  22. public int OmapTargets { get; }
  23. public bool OmapSampleMask { get; }
  24. public bool OmapDepth { get; }
  25. public IGpuAccessor GpuAccessor { get; }
  26. public TranslationOptions Options { get; }
  27. public bool TransformFeedbackEnabled { get; }
  28. public int Size { get; private set; }
  29. public byte ClipDistancesWritten { get; private set; }
  30. public FeatureFlags UsedFeatures { get; private set; }
  31. public int Cb1DataSize { get; private set; }
  32. public bool NextUsesFixedFuncAttributes { get; private set; }
  33. public int UsedInputAttributes { get; private set; }
  34. public int UsedOutputAttributes { get; private set; }
  35. public HashSet<int> UsedInputAttributesPerPatch { get; }
  36. public HashSet<int> UsedOutputAttributesPerPatch { get; }
  37. public HashSet<int> NextUsedInputAttributesPerPatch { get; private set; }
  38. public int PassthroughAttributes { get; private set; }
  39. private int _nextUsedInputAttributes;
  40. private int _thisUsedInputAttributes;
  41. private Dictionary<int, int> _perPatchAttributeLocations;
  42. public UInt128 NextInputAttributesComponents { get; private set; }
  43. public UInt128 ThisInputAttributesComponents { get; private set; }
  44. private int _usedConstantBuffers;
  45. private int _usedStorageBuffers;
  46. private int _usedStorageBuffersWrite;
  47. private struct TextureInfo : IEquatable<TextureInfo>
  48. {
  49. public int CbufSlot { get; }
  50. public int Handle { get; }
  51. public bool Indexed { get; }
  52. public TextureFormat Format { get; }
  53. public TextureInfo(int cbufSlot, int handle, bool indexed, TextureFormat format)
  54. {
  55. CbufSlot = cbufSlot;
  56. Handle = handle;
  57. Indexed = indexed;
  58. Format = format;
  59. }
  60. public override bool Equals(object obj)
  61. {
  62. return obj is TextureInfo other && Equals(other);
  63. }
  64. public bool Equals(TextureInfo other)
  65. {
  66. return CbufSlot == other.CbufSlot && Handle == other.Handle && Indexed == other.Indexed && Format == other.Format;
  67. }
  68. public override int GetHashCode()
  69. {
  70. return HashCode.Combine(CbufSlot, Handle, Indexed, Format);
  71. }
  72. }
  73. private struct TextureMeta
  74. {
  75. public bool AccurateType;
  76. public SamplerType Type;
  77. public TextureUsageFlags UsageFlags;
  78. }
  79. private readonly Dictionary<TextureInfo, TextureMeta> _usedTextures;
  80. private readonly Dictionary<TextureInfo, TextureMeta> _usedImages;
  81. private BufferDescriptor[] _cachedConstantBufferDescriptors;
  82. private BufferDescriptor[] _cachedStorageBufferDescriptors;
  83. private TextureDescriptor[] _cachedTextureDescriptors;
  84. private TextureDescriptor[] _cachedImageDescriptors;
  85. private int _firstConstantBufferBinding;
  86. private int _firstStorageBufferBinding;
  87. public int FirstConstantBufferBinding => _firstConstantBufferBinding;
  88. public int FirstStorageBufferBinding => _firstStorageBufferBinding;
  89. public ShaderConfig(IGpuAccessor gpuAccessor, TranslationOptions options)
  90. {
  91. Stage = ShaderStage.Compute;
  92. GpuAccessor = gpuAccessor;
  93. Options = options;
  94. UsedInputAttributesPerPatch = new HashSet<int>();
  95. UsedOutputAttributesPerPatch = new HashSet<int>();
  96. _usedTextures = new Dictionary<TextureInfo, TextureMeta>();
  97. _usedImages = new Dictionary<TextureInfo, TextureMeta>();
  98. }
  99. public ShaderConfig(ShaderHeader header, IGpuAccessor gpuAccessor, TranslationOptions options) : this(gpuAccessor, options)
  100. {
  101. Stage = header.Stage;
  102. GpPassthrough = header.Stage == ShaderStage.Geometry && header.GpPassthrough;
  103. ThreadsPerInputPrimitive = header.ThreadsPerInputPrimitive;
  104. OutputTopology = header.OutputTopology;
  105. MaxOutputVertices = header.MaxOutputVertexCount;
  106. LocalMemorySize = header.ShaderLocalMemoryLowSize + header.ShaderLocalMemoryHighSize + (header.ShaderLocalMemoryCrsSize / ThreadsPerWarp);
  107. ImapTypes = header.ImapTypes;
  108. OmapTargets = header.OmapTargets;
  109. OmapSampleMask = header.OmapSampleMask;
  110. OmapDepth = header.OmapDepth;
  111. TransformFeedbackEnabled = gpuAccessor.QueryTransformFeedbackEnabled();
  112. LastInVertexPipeline = header.Stage < ShaderStage.Fragment;
  113. }
  114. public int GetDepthRegister()
  115. {
  116. // The depth register is always two registers after the last color output.
  117. return BitOperations.PopCount((uint)OmapTargets) + 1;
  118. }
  119. public uint ConstantBuffer1Read(int offset)
  120. {
  121. if (Cb1DataSize < offset + 4)
  122. {
  123. Cb1DataSize = offset + 4;
  124. }
  125. return GpuAccessor.ConstantBuffer1Read(offset);
  126. }
  127. public TextureFormat GetTextureFormat(int handle, int cbufSlot = -1)
  128. {
  129. // When the formatted load extension is supported, we don't need to
  130. // specify a format, we can just declare it without a format and the GPU will handle it.
  131. if (GpuAccessor.QueryHostSupportsImageLoadFormatted())
  132. {
  133. return TextureFormat.Unknown;
  134. }
  135. var format = GpuAccessor.QueryTextureFormat(handle, cbufSlot);
  136. if (format == TextureFormat.Unknown)
  137. {
  138. GpuAccessor.Log($"Unknown format for texture {handle}.");
  139. format = TextureFormat.R8G8B8A8Unorm;
  140. }
  141. return format;
  142. }
  143. private bool FormatSupportsAtomic(TextureFormat format)
  144. {
  145. return format == TextureFormat.R32Sint || format == TextureFormat.R32Uint;
  146. }
  147. public TextureFormat GetTextureFormatAtomic(int handle, int cbufSlot = -1)
  148. {
  149. // Atomic image instructions do not support GL_EXT_shader_image_load_formatted,
  150. // and must have a type specified. Default to R32Sint if not available.
  151. var format = GpuAccessor.QueryTextureFormat(handle, cbufSlot);
  152. if (!FormatSupportsAtomic(format))
  153. {
  154. GpuAccessor.Log($"Unsupported format for texture {handle}: {format}.");
  155. format = TextureFormat.R32Sint;
  156. }
  157. return format;
  158. }
  159. public void SizeAdd(int size)
  160. {
  161. Size += size;
  162. }
  163. public void InheritFrom(ShaderConfig other)
  164. {
  165. ClipDistancesWritten |= other.ClipDistancesWritten;
  166. UsedFeatures |= other.UsedFeatures;
  167. UsedInputAttributes |= other.UsedInputAttributes;
  168. UsedOutputAttributes |= other.UsedOutputAttributes;
  169. _usedConstantBuffers |= other._usedConstantBuffers;
  170. _usedStorageBuffers |= other._usedStorageBuffers;
  171. _usedStorageBuffersWrite |= other._usedStorageBuffersWrite;
  172. foreach (var kv in other._usedTextures)
  173. {
  174. if (!_usedTextures.TryAdd(kv.Key, kv.Value))
  175. {
  176. _usedTextures[kv.Key] = MergeTextureMeta(kv.Value, _usedTextures[kv.Key]);
  177. }
  178. }
  179. foreach (var kv in other._usedImages)
  180. {
  181. if (!_usedImages.TryAdd(kv.Key, kv.Value))
  182. {
  183. _usedImages[kv.Key] = MergeTextureMeta(kv.Value, _usedImages[kv.Key]);
  184. }
  185. }
  186. }
  187. public void SetInputUserAttributeFixedFunc(int index)
  188. {
  189. UsedInputAttributes |= 1 << index;
  190. }
  191. public void SetOutputUserAttributeFixedFunc(int index)
  192. {
  193. UsedOutputAttributes |= 1 << index;
  194. }
  195. public void SetInputUserAttribute(int index, int component)
  196. {
  197. int mask = 1 << index;
  198. UsedInputAttributes |= mask;
  199. _thisUsedInputAttributes |= mask;
  200. ThisInputAttributesComponents |= UInt128.Pow2(index * 4 + component);
  201. }
  202. public void SetInputUserAttributePerPatch(int index)
  203. {
  204. UsedInputAttributesPerPatch.Add(index);
  205. }
  206. public void SetOutputUserAttribute(int index)
  207. {
  208. UsedOutputAttributes |= 1 << index;
  209. }
  210. public void SetOutputUserAttributePerPatch(int index)
  211. {
  212. UsedOutputAttributesPerPatch.Add(index);
  213. }
  214. public void MergeFromtNextStage(ShaderConfig config)
  215. {
  216. NextInputAttributesComponents = config.ThisInputAttributesComponents;
  217. NextUsedInputAttributesPerPatch = config.UsedInputAttributesPerPatch;
  218. NextUsesFixedFuncAttributes = config.UsedFeatures.HasFlag(FeatureFlags.FixedFuncAttr);
  219. MergeOutputUserAttributes(config.UsedInputAttributes, config.UsedInputAttributesPerPatch);
  220. if (UsedOutputAttributesPerPatch.Count != 0)
  221. {
  222. // Regular and per-patch input/output locations can't overlap,
  223. // so we must assign on our location using unused regular input/output locations.
  224. Dictionary<int, int> locationsMap = new Dictionary<int, int>();
  225. int freeMask = ~UsedOutputAttributes;
  226. foreach (int attr in UsedOutputAttributesPerPatch)
  227. {
  228. int location = BitOperations.TrailingZeroCount(freeMask);
  229. if (location == 32)
  230. {
  231. config.GpuAccessor.Log($"No enough free locations for patch input/output 0x{attr:X}.");
  232. break;
  233. }
  234. locationsMap.Add(attr, location);
  235. freeMask &= ~(1 << location);
  236. }
  237. // Both stages must agree on the locations, so use the same "map" for both.
  238. _perPatchAttributeLocations = locationsMap;
  239. config._perPatchAttributeLocations = locationsMap;
  240. }
  241. if (config.Stage != ShaderStage.Fragment)
  242. {
  243. LastInVertexPipeline = false;
  244. }
  245. }
  246. public void MergeOutputUserAttributes(int mask, IEnumerable<int> perPatch)
  247. {
  248. _nextUsedInputAttributes = mask;
  249. if (GpPassthrough)
  250. {
  251. PassthroughAttributes = mask & ~UsedOutputAttributes;
  252. }
  253. else
  254. {
  255. UsedOutputAttributes |= mask;
  256. UsedOutputAttributesPerPatch.UnionWith(perPatch);
  257. }
  258. }
  259. public int GetPerPatchAttributeLocation(int index)
  260. {
  261. if (_perPatchAttributeLocations == null || !_perPatchAttributeLocations.TryGetValue(index, out int location))
  262. {
  263. return index;
  264. }
  265. return location;
  266. }
  267. public bool IsUsedOutputAttribute(int attr)
  268. {
  269. // The check for fixed function attributes on the next stage is conservative,
  270. // returning false if the output is just not used by the next stage is also valid.
  271. if (NextUsesFixedFuncAttributes &&
  272. attr >= AttributeConsts.UserAttributeBase &&
  273. attr < AttributeConsts.UserAttributeEnd)
  274. {
  275. int index = (attr - AttributeConsts.UserAttributeBase) >> 4;
  276. return (_nextUsedInputAttributes & (1 << index)) != 0;
  277. }
  278. return true;
  279. }
  280. public int GetFreeUserAttribute(bool isOutput, int index)
  281. {
  282. int useMask = isOutput ? _nextUsedInputAttributes : _thisUsedInputAttributes;
  283. int bit = -1;
  284. while (useMask != -1)
  285. {
  286. bit = BitOperations.TrailingZeroCount(~useMask);
  287. if (bit == 32)
  288. {
  289. bit = -1;
  290. break;
  291. }
  292. else if (index < 1)
  293. {
  294. break;
  295. }
  296. useMask |= 1 << bit;
  297. index--;
  298. }
  299. return bit;
  300. }
  301. public void SetAllInputUserAttributes()
  302. {
  303. UsedInputAttributes |= Constants.AllAttributesMask;
  304. ThisInputAttributesComponents |= ~UInt128.Zero >> (128 - Constants.MaxAttributes * 4);
  305. }
  306. public void SetAllOutputUserAttributes()
  307. {
  308. UsedOutputAttributes |= Constants.AllAttributesMask;
  309. }
  310. public void SetClipDistanceWritten(int index)
  311. {
  312. ClipDistancesWritten |= (byte)(1 << index);
  313. }
  314. public void SetUsedFeature(FeatureFlags flags)
  315. {
  316. UsedFeatures |= flags;
  317. }
  318. public void SetUsedConstantBuffer(int slot)
  319. {
  320. _usedConstantBuffers |= 1 << slot;
  321. }
  322. public void SetUsedStorageBuffer(int slot, bool write)
  323. {
  324. int mask = 1 << slot;
  325. _usedStorageBuffers |= mask;
  326. if (write)
  327. {
  328. _usedStorageBuffersWrite |= mask;
  329. }
  330. }
  331. public void SetUsedTexture(
  332. Instruction inst,
  333. SamplerType type,
  334. TextureFormat format,
  335. TextureFlags flags,
  336. int cbufSlot,
  337. int handle)
  338. {
  339. inst &= Instruction.Mask;
  340. bool isImage = inst == Instruction.ImageLoad || inst == Instruction.ImageStore || inst == Instruction.ImageAtomic;
  341. bool isWrite = inst == Instruction.ImageStore || inst == Instruction.ImageAtomic;
  342. bool accurateType = inst != Instruction.Lod && inst != Instruction.TextureSize;
  343. bool coherent = flags.HasFlag(TextureFlags.Coherent);
  344. if (isImage)
  345. {
  346. SetUsedTextureOrImage(_usedImages, cbufSlot, handle, type, format, true, isWrite, false, coherent);
  347. }
  348. else
  349. {
  350. bool intCoords = flags.HasFlag(TextureFlags.IntCoords) || inst == Instruction.TextureSize;
  351. SetUsedTextureOrImage(_usedTextures, cbufSlot, handle, type, TextureFormat.Unknown, intCoords, false, accurateType, coherent);
  352. }
  353. GpuAccessor.RegisterTexture(handle, cbufSlot);
  354. }
  355. private void SetUsedTextureOrImage(
  356. Dictionary<TextureInfo, TextureMeta> dict,
  357. int cbufSlot,
  358. int handle,
  359. SamplerType type,
  360. TextureFormat format,
  361. bool intCoords,
  362. bool write,
  363. bool accurateType,
  364. bool coherent)
  365. {
  366. var dimensions = type.GetDimensions();
  367. var isIndexed = type.HasFlag(SamplerType.Indexed);
  368. var usageFlags = TextureUsageFlags.None;
  369. if (intCoords)
  370. {
  371. usageFlags |= TextureUsageFlags.NeedsScaleValue;
  372. var canScale = Stage.SupportsRenderScale() && !isIndexed && !write && dimensions == 2;
  373. if (!canScale)
  374. {
  375. // Resolution scaling cannot be applied to this texture right now.
  376. // Flag so that we know to blacklist scaling on related textures when binding them.
  377. usageFlags |= TextureUsageFlags.ResScaleUnsupported;
  378. }
  379. }
  380. if (write)
  381. {
  382. usageFlags |= TextureUsageFlags.ImageStore;
  383. }
  384. if (coherent)
  385. {
  386. usageFlags |= TextureUsageFlags.ImageCoherent;
  387. }
  388. int arraySize = isIndexed ? SamplerArraySize : 1;
  389. for (int layer = 0; layer < arraySize; layer++)
  390. {
  391. var info = new TextureInfo(cbufSlot, handle + layer * 2, isIndexed, format);
  392. var meta = new TextureMeta()
  393. {
  394. AccurateType = accurateType,
  395. Type = type,
  396. UsageFlags = usageFlags
  397. };
  398. if (dict.TryGetValue(info, out var existingMeta))
  399. {
  400. dict[info] = MergeTextureMeta(meta, existingMeta);
  401. }
  402. else
  403. {
  404. dict.Add(info, meta);
  405. }
  406. }
  407. }
  408. private static TextureMeta MergeTextureMeta(TextureMeta meta, TextureMeta existingMeta)
  409. {
  410. meta.UsageFlags |= existingMeta.UsageFlags;
  411. // If the texture we have has inaccurate type information, then
  412. // we prefer the most accurate one.
  413. if (existingMeta.AccurateType)
  414. {
  415. meta.AccurateType = true;
  416. meta.Type = existingMeta.Type;
  417. }
  418. return meta;
  419. }
  420. public BufferDescriptor[] GetConstantBufferDescriptors()
  421. {
  422. if (_cachedConstantBufferDescriptors != null)
  423. {
  424. return _cachedConstantBufferDescriptors;
  425. }
  426. int usedMask = _usedConstantBuffers;
  427. if (UsedFeatures.HasFlag(FeatureFlags.CbIndexing))
  428. {
  429. usedMask |= (int)GpuAccessor.QueryConstantBufferUse();
  430. }
  431. return _cachedConstantBufferDescriptors = GetBufferDescriptors(
  432. usedMask,
  433. 0,
  434. UsedFeatures.HasFlag(FeatureFlags.CbIndexing),
  435. out _firstConstantBufferBinding,
  436. GpuAccessor.QueryBindingConstantBuffer);
  437. }
  438. public BufferDescriptor[] GetStorageBufferDescriptors()
  439. {
  440. if (_cachedStorageBufferDescriptors != null)
  441. {
  442. return _cachedStorageBufferDescriptors;
  443. }
  444. return _cachedStorageBufferDescriptors = GetBufferDescriptors(
  445. _usedStorageBuffers,
  446. _usedStorageBuffersWrite,
  447. true,
  448. out _firstStorageBufferBinding,
  449. GpuAccessor.QueryBindingStorageBuffer);
  450. }
  451. private static BufferDescriptor[] GetBufferDescriptors(
  452. int usedMask,
  453. int writtenMask,
  454. bool isArray,
  455. out int firstBinding,
  456. Func<int, int> getBindingCallback)
  457. {
  458. firstBinding = 0;
  459. bool hasFirstBinding = false;
  460. var descriptors = new BufferDescriptor[BitOperations.PopCount((uint)usedMask)];
  461. int lastSlot = -1;
  462. for (int i = 0; i < descriptors.Length; i++)
  463. {
  464. int slot = BitOperations.TrailingZeroCount(usedMask);
  465. if (isArray)
  466. {
  467. // The next array entries also consumes bindings, even if they are unused.
  468. for (int j = lastSlot + 1; j < slot; j++)
  469. {
  470. int binding = getBindingCallback(j);
  471. if (!hasFirstBinding)
  472. {
  473. firstBinding = binding;
  474. hasFirstBinding = true;
  475. }
  476. }
  477. }
  478. lastSlot = slot;
  479. descriptors[i] = new BufferDescriptor(getBindingCallback(slot), slot);
  480. if (!hasFirstBinding)
  481. {
  482. firstBinding = descriptors[i].Binding;
  483. hasFirstBinding = true;
  484. }
  485. if ((writtenMask & (1 << slot)) != 0)
  486. {
  487. descriptors[i].SetFlag(BufferUsageFlags.Write);
  488. }
  489. usedMask &= ~(1 << slot);
  490. }
  491. return descriptors;
  492. }
  493. public TextureDescriptor[] GetTextureDescriptors()
  494. {
  495. return _cachedTextureDescriptors ??= GetTextureOrImageDescriptors(_usedTextures, GpuAccessor.QueryBindingTexture);
  496. }
  497. public TextureDescriptor[] GetImageDescriptors()
  498. {
  499. return _cachedImageDescriptors ??= GetTextureOrImageDescriptors(_usedImages, GpuAccessor.QueryBindingImage);
  500. }
  501. private static TextureDescriptor[] GetTextureOrImageDescriptors(Dictionary<TextureInfo, TextureMeta> dict, Func<int, bool, int> getBindingCallback)
  502. {
  503. var descriptors = new TextureDescriptor[dict.Count];
  504. int i = 0;
  505. foreach (var kv in dict.OrderBy(x => x.Key.Indexed).OrderBy(x => x.Key.Handle))
  506. {
  507. var info = kv.Key;
  508. var meta = kv.Value;
  509. bool isBuffer = (meta.Type & SamplerType.Mask) == SamplerType.TextureBuffer;
  510. int binding = getBindingCallback(i, isBuffer);
  511. descriptors[i] = new TextureDescriptor(binding, meta.Type, info.Format, info.CbufSlot, info.Handle);
  512. descriptors[i].SetFlag(meta.UsageFlags);
  513. i++;
  514. }
  515. return descriptors;
  516. }
  517. public (TextureDescriptor, int) FindTextureDescriptor(AstTextureOperation texOp)
  518. {
  519. TextureDescriptor[] descriptors = GetTextureDescriptors();
  520. for (int i = 0; i < descriptors.Length; i++)
  521. {
  522. var descriptor = descriptors[i];
  523. if (descriptor.CbufSlot == texOp.CbufSlot &&
  524. descriptor.HandleIndex == texOp.Handle &&
  525. descriptor.Format == texOp.Format)
  526. {
  527. return (descriptor, i);
  528. }
  529. }
  530. return (default, -1);
  531. }
  532. private static int FindDescriptorIndex(TextureDescriptor[] array, AstTextureOperation texOp)
  533. {
  534. for (int i = 0; i < array.Length; i++)
  535. {
  536. var descriptor = array[i];
  537. if (descriptor.Type == texOp.Type &&
  538. descriptor.CbufSlot == texOp.CbufSlot &&
  539. descriptor.HandleIndex == texOp.Handle &&
  540. descriptor.Format == texOp.Format)
  541. {
  542. return i;
  543. }
  544. }
  545. return -1;
  546. }
  547. public int FindTextureDescriptorIndex(AstTextureOperation texOp)
  548. {
  549. return FindDescriptorIndex(GetTextureDescriptors(), texOp);
  550. }
  551. public int FindImageDescriptorIndex(AstTextureOperation texOp)
  552. {
  553. return FindDescriptorIndex(GetImageDescriptors(), texOp);
  554. }
  555. }
  556. }