# SM5 on Linux is limited to 16 texture samplers

**URL:** <https://forums.unrealengine.com/t/sm5-on-linux-is-limited-to-16-texture-samplers/342528>\
**Category:** Rendering\
**Tags:** opengl, Linux, unreal-engine, question\
**Created:** [December 27, 2015, 7:28pm UTC](https://forums.unrealengine.com/t/sm5-on-linux-is-limited-to-16-texture-samplers/342528 "2015-12-27T19:28:27Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_e955dac61](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e955dac61](https://forums.unrealengine.com/u/anonymous_user_e955dac61)\
**Post date:** [December 27, 2015, 7:28pm UTC](https://forums.unrealengine.com/t/sm5-on-linux-is-limited-to-16-texture-samplers/342528/1 "2015-12-27T19:28:27Z")

</div>

Using Unreal Engine 4.10.1 on Linux, Shader Model 5 (OpenGL 4.3) is limited to 16 texture samplers per material, no matter what the samplers are set to use as their texture source (clamp or wrap).

I’m running the editor from the terminal, using the -opengl4 switch. The default memory allocator (binned) is used.

The engine is a direct-from-github compilation of the Release branch.

System information:  
Linux Mint 17.3 Rosa (64-bit)  
Nvida GeForce GTX 660Ti, 2048MB  
Engine Version: 4.10.1-0+++depot+UE4-Releases+4.10

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [January 4, 2016, 7:31pm UTC](https://forums.unrealengine.com/t/sm5-on-linux-is-limited-to-16-texture-samplers/342528/2 "2016-01-04T19:31:49Z")

</div>

Hey -

How are you setting up your texture/texture sample in the editor? Can you provide a screenshot of exactly what you see when applying the texture?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_e955dac61](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e955dac61](https://forums.unrealengine.com/u/anonymous_user_e955dac61)\
**Post date:** [January 5, 2016, 5:40pm UTC](https://forums.unrealengine.com/t/sm5-on-linux-is-limited-to-16-texture-samplers/342528/3 "2016-01-05T17:40:35Z")

</div>

Sure thing! This is the error produced in the terminal:

```
[2016.01.05-17.34.25:306][244]LogShaderCompilers:Warning: Failed to compile Material /Game/Materials/Maps/Tileset/Feralas.Feralas for platform GLSL_430, Default Material will be used in game.

```

As for the material, it’s set up like this:

 ![73021-samplererror.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/8/e/48e08f50a04cb943137f90bcc139d4b5a2f111d0.png)

The samplers are just textures, and they’re all set to Wrap. Same thing happens for Clamp, and I’m not 100% sure what the difference between them are x)

The Layer Blend just plugs right into BaseColor, and the visible network is replicated below for normal maps as well. I’m afraid I can’t show you an in-game screenshot at the moment, as I’m experiencing the black viewport bug again (for some reason, Scalability won’t override ProjectSettings, but that’s a whole 'nother bug report), but I’m sure you can picture gray checkerboards everywhere x) The default material is used everywhere the material is applied when it won’t compile.

The very same material works fine on Windows, where it was originally created.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [January 7, 2016, 9:11pm UTC](https://forums.unrealengine.com/t/sm5-on-linux-is-limited-to-16-texture-samplers/342528/4 "2016-01-07T21:11:00Z")

</div>

After setting up a material based on your description/screenshot I realized that the problem is the OpenGL rendering path. As mentioned in the release notes linked below, DirectX can support more textures than OpenGL. Since Linux uses the OpenGL path to enable SM5 it falls into the same restrictions.

Here is the link to the release notes I mentioned.([What's New | Unreal Engine 5.1 Documentation](https://docs.unrealengine.com/latest/INT/Support/Builds/ReleaseNotes/2014/4_6/index.html))

Cheers

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_e955dac61](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e955dac61](https://forums.unrealengine.com/u/anonymous_user_e955dac61)\
**Post date:** [January 7, 2016, 9:26pm UTC](https://forums.unrealengine.com/t/sm5-on-linux-is-limited-to-16-texture-samplers/342528/5 "2016-01-07T21:26:14Z")

</div>

Yes, this is sort of what this report is about x)

As I have understood it, OpenGL 4.1 and below does not support more than 16 samplers, period. However, OpenGL 4.3 does support more than that, and the engine can and does run on 4.3 when running on Linux. I recall someone saying (can’t remember who) that Mac is stuck on 4.1 for now, but that doesn’t have to be the case for other platforms.

Are you absolutely certain that it is not possible to circumvent the limitation on Linux?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [January 8, 2016, 3:06pm UTC](https://forums.unrealengine.com/t/sm5-on-linux-is-limited-to-16-texture-samplers/342528/6 "2016-01-08T15:06:45Z")

</div>

I have not been able to find any information about OpenGL4.3 supporting a different number of samples than previous versions. Could you post the link to where you found this information originally?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_e955dac61](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e955dac61](https://forums.unrealengine.com/u/anonymous_user_e955dac61)\
**Post date:** [January 8, 2016, 4:26pm UTC](https://forums.unrealengine.com/t/sm5-on-linux-is-limited-to-16-texture-samplers/342528/7 "2016-01-08T16:26:19Z")

</div>

I’m searching for the original link at the moment, but it has been [mentioned by Epic staff before](https://answers.unrealengine.com/questions/232852/openglbug-shared-texture-samples-do-not-work-in-op.html).

According to marksatt-pitbull, it’s filed internally as UE-18641.

I did come across some discussions about circumventing the limitation [here](https://www.opengl.org/discussion_boards/showthread.php/177721-Limit-of-32-samplers-in-GLSL-shaders), for instance. However, I’m not a graphics programmer, so I can’t say for sure if it’s relevant. I’ll keep searching and talk to some buddies who are more involved in the rendering side of things.

---

<div class="post-metadata">

**Author:** ![eWomerOC](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@eWomerOC](https://forums.unrealengine.com/u/eWomerOC)\
**Post date:** [January 8, 2016, 9:20pm UTC](https://forums.unrealengine.com/t/sm5-on-linux-is-limited-to-16-texture-samplers/342528/8 "2016-01-08T21:20:22Z")

</div>

The sample thing is supposed to work, but it does not, I don’t know if they will ever fix it though.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_bb2eb5ea](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_bb2eb5ea](https://forums.unrealengine.com/u/anonymous_user_bb2eb5ea)\
**Post date:** [February 6, 2016, 11:34am UTC](https://forums.unrealengine.com/t/sm5-on-linux-is-limited-to-16-texture-samplers/342528/9 "2016-02-06T11:34:21Z")

</div>

Still broken with the latest UE for the ocean project:

> **[\[Community Project\] WIP Weather & Water Shader](https://forums.unrealengine.com/showthread.php?42092-Community-Project-WIP-Weather-amp-Ocean-Water-Shader%2Fpage28)**
>
> \*\*Welcome to the community created Simulation, Weather (WIP), and Dynamic TOD system! \*\* \*\*The point of project is twofold. First, it aims to provide a realistic water simulation that is both highly customizable, and being as physically accurate...

Ubuntu, OpenGL 4.5, shadermodel 5

Will continue on Windows and hope it gets fixed before my game is finished. Thanks

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_dccfae57](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_dccfae57](https://forums.unrealengine.com/u/anonymous_user_dccfae57)\
**Post date:** [July 14, 2016, 12:20am UTC](https://forums.unrealengine.com/t/sm5-on-linux-is-limited-to-16-texture-samplers/342528/10 "2016-07-14T00:20:39Z")

</div>

Is this going to receive any attention? I’m seeing this error while attempting to work on UT4 on Linux.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [July 14, 2016, 12:45pm UTC](https://forums.unrealengine.com/t/sm5-on-linux-is-limited-to-16-texture-samplers/342528/11 "2016-07-14T12:45:30Z")

</div>

Currently our resources are dedicated elsewhere and UE-18641 is not a priority item for us to work on. We don’t have a timeframe for when this may be addressed. I have added additional comments to UE-18641 to indicate that this is still affecting many community members. Please keep in mind that with source code access, a programmer on your project can implement your own solution, and you are welcome to share that result with Epic for possible integration.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_dccfae57](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_dccfae57](https://forums.unrealengine.com/u/anonymous_user_dccfae57)\
**Post date:** [July 15, 2016, 1:59am UTC](https://forums.unrealengine.com/t/sm5-on-linux-is-limited-to-16-texture-samplers/342528/12 "2016-07-15T01:59:51Z")

</div>

Definitely, and this is something we’re looking into. I’m not sure the current restriction even corresponds to the current state of OpenGL on Linux since most of the information I can find states modern cards expose at _least_ 32 texture units.

Is there any information in the internal bug report that might be useful if I decide to look into this?

Thanks!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [July 15, 2016, 12:37pm UTC](https://forums.unrealengine.com/t/sm5-on-linux-is-limited-to-16-texture-samplers/342528/13 "2016-07-15T12:37:24Z")

</div>

The bug report simply states that the issue with texture samples exists with information on reproducing it for internal testing.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_0f8db508](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0f8db508](https://forums.unrealengine.com/u/anonymous_user_0f8db508)\
**Post date:** [July 16, 2016, 11:47pm UTC](https://forums.unrealengine.com/t/sm5-on-linux-is-limited-to-16-texture-samplers/342528/14 "2016-07-16T23:47:51Z")

</div>

This issue is now plaguing Unreal Tournament 4 under Linux. It’s affecting the post-processing and the Underland map, as well as most community made maps. This is seriously negatively affecting the Linux community’s user experience with UT4. Please make this a priority.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_dccfae57](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_dccfae57](https://forums.unrealengine.com/u/anonymous_user_dccfae57)\
**Post date:** [July 18, 2016, 4:25am UTC](https://forums.unrealengine.com/t/sm5-on-linux-is-limited-to-16-texture-samplers/342528/15 "2016-07-18T04:25:15Z")

</div>

I believe I have a fix for this. Currently undergoing testing.

---

<div class="post-metadata">

**Author:** ![VSZ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@VSZ](https://forums.unrealengine.com/u/VSZ)\
**Post date:** [July 18, 2016, 2:14pm UTC](https://forums.unrealengine.com/t/sm5-on-linux-is-limited-to-16-texture-samplers/342528/16 "2016-07-18T14:14:16Z")

</div>

+1, just wanted to add that this is affecting my game’s Linux experience too.

Thanks to @madscientist159 for attempting a fix; engine-level code is a bit intimidating to dive into so I’m hoping you or Epic can rescue the rest of us with a fix! Thanks to everyone for all your efforts.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_dccfae57](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_dccfae57](https://forums.unrealengine.com/u/anonymous_user_dccfae57)\
**Post date:** [July 18, 2016, 6:48pm UTC](https://forums.unrealengine.com/t/sm5-on-linux-is-limited-to-16-texture-samplers/342528/17 "2016-07-18T18:48:52Z")

</div>

Fix ended up being fairly trivial. Per Epic’s wishes the OpenGL 3 path limit was left at 16 shaders for Mac compatibility, but the OpenGL 4.3 path limit was increased to 32 shaders. Testing the modification on OpenGL 4.3 (Gallium / mesa 12) showed much improved graphics and no obvious glitches when compared with the previous codebase.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_e955dac61](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e955dac61](https://forums.unrealengine.com/u/anonymous_user_e955dac61)\
**Post date:** [July 26, 2016, 6:27pm UTC](https://forums.unrealengine.com/t/sm5-on-linux-is-limited-to-16-texture-samplers/342528/18 "2016-07-26T18:27:22Z")

</div>

Epic just opened up their internal issue tracker for direct voting on issues. This one is considered backlogged, but we might get them to move on it if we vote it up.

> **[The Unreal Engine Issues and Bug Tracker](https://issues.unrealengine.com/issue/UE-18641)**
>
> Welcome to the Unreal Engine Issue and Bug Tracker. You can check the status of an issue and search for existing bugs. See latest bug fixes too.

---

<div class="post-metadata">

**Author:** ![eWomerOC](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@eWomerOC](https://forums.unrealengine.com/u/eWomerOC)\
**Post date:** [January 8, 2017, 10:28pm UTC](https://forums.unrealengine.com/t/sm5-on-linux-is-limited-to-16-texture-samplers/342528/19 "2017-01-08T22:28:16Z")

</div>

Yeah, with the OceanProject from TheZoc repo and 4.14 (he updated his to 4.14 because the official is stuck at 4.12) we still get the texture samples limit error message with opengl4 and sm5. [http://imgur.com/a/HrOba](http://imgur.com/a/HrOba) Here is a screen shot of an instance of the Ocean Material. I can see the ocean, its glitchy at best, while disabling tessellation, but tessellation is needed for this project. It still complains about going over 16 samples. 22/16
