| 904 | } |
| 905 | |
| 906 | static void GetRenderContextTextures(HRenderContext render_context, const dmArray<Sampler>& samplers, dmGraphics::HTexture* textures) |
| 907 | { |
| 908 | uint32_t num_bindings = render_context->m_TextureBindTable.Size(); |
| 909 | for (uint32_t i = 0; i < num_bindings; ++i) |
| 910 | { |
| 911 | uint32_t sampler_index = i; |
| 912 | dmGraphics::HTexture texture = textures[i]; |
| 913 | |
| 914 | // If a texture has been bound by a sampler hash, the material must have a valid sampler for it |
| 915 | if (render_context->m_TextureBindTable[i].m_Samplerhash) |
| 916 | { |
| 917 | int32_t hash_sampler_index = GetProgramSamplerIndex(samplers, render_context->m_TextureBindTable[i].m_Samplerhash); |
| 918 | if (hash_sampler_index >= 0) |
| 919 | { |
| 920 | sampler_index = hash_sampler_index; |
| 921 | texture = render_context->m_TextureBindTable[i].m_Texture; |
| 922 | } |
| 923 | // The sampler doesn't exist, so we ignore it. |
| 924 | else continue; |
| 925 | } |
| 926 | else if (texture == 0) |
| 927 | { |
| 928 | texture = render_context->m_TextureBindTable[i].m_Texture; |
| 929 | } |
| 930 | |
| 931 | if (sampler_index >= 0 && sampler_index < RenderObject::MAX_TEXTURE_COUNT) |
| 932 | { |
| 933 | textures[sampler_index] = texture; |
| 934 | } |
| 935 | else |
| 936 | { |
| 937 | dmLogOnceWarning("Unable to bind texture to unit %d, max %d texture units are supported.", i, RenderObject::MAX_TEXTURE_COUNT); |
| 938 | } |
| 939 | } |
| 940 | } |
| 941 | |
| 942 | Result DrawRenderList(HRenderContext context, HPredicate predicate, HNamedConstantBuffer constant_buffer, const FrustumOptions* frustum_options, SortOrder sort_order) |
| 943 | { |
no test coverage detected