| 788 | } |
| 789 | |
| 790 | bool GetCanBindTexture(dmGraphics::HContext context, dmGraphics::HTexture texture, HSampler sampler, uint32_t unit) |
| 791 | { |
| 792 | dmGraphics::TextureType texture_type = dmGraphics::GetTextureType(context, texture); |
| 793 | Sampler* s = (Sampler*) sampler; |
| 794 | |
| 795 | if (s == 0x0) |
| 796 | { |
| 797 | dmLogError("Unable to bind texture with type %s to a null sampler (texture unit %d).", |
| 798 | dmGraphics::GetTextureTypeLiteral(texture_type), unit); |
| 799 | return false; |
| 800 | } |
| 801 | |
| 802 | if (texture_type != s->m_Type) |
| 803 | { |
| 804 | dmLogError("Unable to bind texture with type %s to a sampler with type %s (texture unit %d).", |
| 805 | dmGraphics::GetTextureTypeLiteral(texture_type), |
| 806 | dmGraphics::GetTextureTypeLiteral(s->m_Type), |
| 807 | unit); |
| 808 | return false; |
| 809 | } |
| 810 | |
| 811 | uint8_t num_sub_handles = dmGraphics::GetNumTextureHandles(context, texture); |
| 812 | if (num_sub_handles > s->m_UnitValueCount) |
| 813 | { |
| 814 | dmLogError("Unable to bind array texture with %d handles to a sampler with %d bind slots", |
| 815 | num_sub_handles, s->m_UnitValueCount); |
| 816 | return false; |
| 817 | } |
| 818 | return true; |
| 819 | } |
| 820 | } |
nothing calls this directly
no test coverage detected