[2.2] Problem Setting more than 1 manually created textures to pbs Topic is solved

Discussion area about developing with Ogre2 branches (2.1, 2.2 and beyond)
Post Reply
xrgo
OGRE Expert User
OGRE Expert User
Posts: 1039
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 68

[2.2] Problem Setting more than 1 manually created textures to pbs

Post by xrgo » Tue Apr 23, 2019 10:15 pm

Hello!!
I am creating 2 (or more) textures manually (2DArray, 1 slice), which are then filled via workspaces/shaders. I set that textures as diffuse/details/normals/detailNormals, etc. but always its just the first texture I set the one that works, the other ones are "omitted"
in quotes because: Its not being binded in the shader (checked with renderdoc), but the shader it is generating the corresponding blocks, but its using the first texture for it.
For example, something like this (pseudocode):

Code: Select all

texture1 = createTexture( myTextureONE );
texture2 = createTexture( myTextureTWO );

datablock->setTexture( DIFFUSE, texture1  );
datablock->setTexture( DETAIL0, texture2  );
renderdoc shows something like this:

Code: Select all

slot 5: textureMaps0  myTextureONE
and in the shader:

Code: Select all

	 uniform sampler2DArray textureMaps0;
........
         vec4 detailCol0 = texture( textureMaps0, vec3( (inPs.uv0.xy), texIndex_detailMapIdx0 ) )
........
	 pixelData.diffuse = texture( textureMaps0, vec3( (inPs.uv0.xy), texIndex_diffuseIdx ) )
If I load the textures from file, everything works as expected:

Code: Select all

texture1 = createOrRetrieveTexture( myTextureONE.dds );
texture2 = createOrRetrieveTexture( myTextureTWO.png ); //with other format to test if it binds a different array

datablock->setTexture( DIFFUSE, texture1  );
datablock->setTexture( DETAIL0, texture2  );
renderdoc shows something like this:

Code: Select all

slot 5: textureMaps0  [Hash 0x324234]
slot 6: textureMaps1  [Hash 0x567657]
and in the shader:

Code: Select all

	 uniform sampler2DArray textureMaps0;
	 uniform sampler2DArray textureMaps1;
........
         vec4 detailCol0 = texture( textureMaps1, vec3( (inPs.uv0.xy), texIndex_detailMapIdx0 ) )
........
	 pixelData.diffuse = texture( textureMaps0, vec3( (inPs.uv0.xy), texIndex_diffuseIdx ) )
another clue is that on fillBuffersFor, the datablock's mTextureDescSet->mTextures has a mCapacity/mSize of 1 in the first case and 2 in the second case

I also tried with N textures and when they are manually created.. mCapacity/mSize is always 1 and with textures loaded by file is indeed N

I am still looking for more clues

thanks!
0 x

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 4039
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 215
Contact:

Re: [2.2] Problem Setting more than 1 manually created textures to pbs

Post by dark_sylinc » Wed Apr 24, 2019 5:24 am

I think this fix should take care of your bug.

Both pools are nullptr so the system thinks they're part of the same pool (which is wrong).

We had a similar bug in that file like two months ago, I think it was you who reported it.

Thanks for the report!
1 x

xrgo
OGRE Expert User
OGRE Expert User
Posts: 1039
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 68

Re: [2.2] Problem Setting more than 1 manually created textures to pbs

Post by xrgo » Wed Apr 24, 2019 3:54 pm

thank you! its working
0 x

Post Reply