[1.12.0] MyGUI not rendered with DX9

Problems building or running the engine, queries about how to use features etc.
Post Reply
Pellaeon
Goblin
Posts: 230
Joined: Thu Apr 28, 2011 12:23 pm
x 28

[1.12.0] MyGUI not rendered with DX9

Post by Pellaeon »

Hi,

beneath my DX11 problem, I have another issue with version 1.12.0. When using the DX9 plugin, my myGUI content isn't rendered. Now, when I switch to OGL or to DX11 (but with the release problem) then the GUI widgets are visible. So I suppose it's a problem with the DX9 plugin (the patch with the black textures I already fixed)

Regards

Pellaeon
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: [1.12.0] MyGUI not rendered with DX9

Post by paroj »

do you already have this patch applied? https://github.com/OGRECave/ogre/pull/1185
Pellaeon
Goblin
Posts: 230
Joined: Thu Apr 28, 2011 12:23 pm
x 28

Re: [1.12.0] MyGUI not rendered with DX9

Post by Pellaeon »

paroj wrote: Tue May 21, 2019 11:28 am do you already have this patch applied? https://github.com/OGRECave/ogre/pull/1185
Yes I did. Without the patch the whole scene was very funny in my application. After recompiling ogre with the ZeroMemory the model was rendered fine, but it didn't solve the mygui problem.

Regards
User avatar
suny
Greenskin
Posts: 137
Joined: Thu Mar 12, 2020 5:53 pm
x 60

Re: [1.12.0] MyGUI not rendered with DX9

Post by suny »

Same for me:
Ogre 1.12.5 with the latest MyGUI doesn't render anything with DirectX9. That's really a shame and prevent me to go from 1.11 to 1.12...
S.
User avatar
suny
Greenskin
Posts: 137
Joined: Thu Mar 12, 2020 5:53 pm
x 60

Re: [1.12.0] MyGUI not rendered with DX9

Post by suny »

Ok, I asked MuGUI coder Altren, and he told me:

There is special logic in MyGUI_OgreRenderManager.cpp for the DX11, could you try it for DX9 and 12?

Code: Select all

if (mRenderSystem->getName() == "Direct3D11 Rendering Subsystem") // special case, it's not working with the value returned by the rendersystem { mInfo.maximumDepth = 0.0f; } else { mInfo.maximumDepth = mRenderSystem->getMaximumDepthInputValue(); }
I forced to :

Code: Select all

mInfo.maximumDepth = 0.0f; 
And MyGUI is now rendering with Dx9.
Thanks!!!
S.
Pellaeon
Goblin
Posts: 230
Joined: Thu Apr 28, 2011 12:23 pm
x 28

Re: [1.12.0] MyGUI not rendered with DX9

Post by Pellaeon »

suny wrote: Mon Apr 13, 2020 1:01 pm Ok, I asked MuGUI coder Altren, and he told me:

There is special logic in MyGUI_OgreRenderManager.cpp for the DX11, could you try it for DX9 and 12?

Code: Select all

if (mRenderSystem->getName() == "Direct3D11 Rendering Subsystem") // special case, it's not working with the value returned by the rendersystem { mInfo.maximumDepth = 0.0f; } else { mInfo.maximumDepth = mRenderSystem->getMaximumDepthInputValue(); }
I forced to :

Code: Select all

mInfo.maximumDepth = 0.0f; 
And MyGUI is now rendering with Dx9.
Thanks!!!
S.
Thanks for the hint. Perhaps I will test it in an existing project. But in general we are moving to imgui and away from MyGUI. Last one is a "dead horse" in my opinion. To less ongoing development.
User avatar
luis
Greenskin
Posts: 122
Joined: Tue Mar 02, 2004 3:33 pm
Location: Spain / Argentina
x 7
Contact:

Re: [1.12.0] MyGUI not rendered with DX9

Post by luis »

Thanks for sharing the hack it worked in Ogre 1.12.2
This is how I added the code:

Code: Select all

	void OgreRenderManager::updateRenderInfo()
	{
		if (mRenderSystem != nullptr)
		{
			if (mRenderSystem->getName() == "Direct3D11 Rendering Subsystem") // special case, it's not working with the value returned by the rendersystem
			{
				mInfo.maximumDepth = 0.0f;
			}
			else if (mRenderSystem->getName() == "Direct3D9 Rendering Subsystem") // special case, it's not working with the value returned by the rendersystem
			{
				mInfo.maximumDepth = 0.0f;
			}
			else
			{
				mInfo.maximumDepth = mRenderSystem->getMaximumDepthInputValue();
			}
			mInfo.hOffset = mRenderSystem->getHorizontalTexelOffset() / float(mViewSize.width);
			mInfo.vOffset = mRenderSystem->getVerticalTexelOffset() / float(mViewSize.height);
			mInfo.aspectCoef = float(mViewSize.height) / float(mViewSize.width);
			mInfo.pixScaleX = 1.0f / float(mViewSize.width);
			mInfo.pixScaleY = 1.0f / float(mViewSize.height);
		}
	}
User avatar
sercero
Bronze Sponsor
Bronze Sponsor
Posts: 449
Joined: Sun Jan 18, 2015 4:20 pm
Location: Buenos Aires, Argentina
x 156

Re: [1.12.0] MyGUI not rendered with DX9

Post by sercero »

I am using OGRE 1.12.9 and the last MyGUI from master branch and on DirectX9 Rendersystem the program crashes.

The other Rendersystems work fine.

The OGRE and MyGUI log do not show much.
Ogre.log:

Code: Select all

22:22:04: Creating resource group General
22:22:04: Creating resource group OgreInternal
22:22:04: Creating resource group OgreAutodetect
22:22:04: SceneManagerFactory for type 'DefaultSceneManager' registered.
22:22:04: Registering ResourceManager for type Material
22:22:04: Registering ResourceManager for type Mesh
22:22:04: Registering ResourceManager for type Skeleton
22:22:04: MovableObjectFactory for type 'ParticleSystem' registered.
22:22:04: ArchiveFactory for archive type FileSystem registered.
22:22:04: ArchiveFactory for archive type Zip registered.
22:22:04: ArchiveFactory for archive type EmbeddedZip registered.
22:22:04: DDS codec registering
22:22:04: ETC codec registering
22:22:04: ASTC codec registering
22:22:04: Registering ResourceManager for type HighLevelGpuProgram
22:22:04: Registering ResourceManager for type Compositor
22:22:04: MovableObjectFactory for type 'Entity' registered.
22:22:04: MovableObjectFactory for type 'Light' registered.
22:22:04: MovableObjectFactory for type 'BillboardSet' registered.
22:22:04: MovableObjectFactory for type 'ManualObject' registered.
22:22:04: MovableObjectFactory for type 'BillboardChain' registered.
22:22:04: MovableObjectFactory for type 'RibbonTrail' registered.
22:22:04: Loading library D:/OGRE2/Built/ogre-1.12.9/bin\RenderSystem_Direct3D9.dll
22:22:04: Installing plugin: D3D9 RenderSystem
22:22:04: D3D9 : Direct3D9 Rendering Subsystem created.
22:22:04: D3D9: Driver Detection Starts
22:22:04: D3D9: Driver Detection Ends
22:22:04: Plugin successfully installed
22:22:04: Loading library D:/OGRE2/Built/ogre-1.12.9/bin\Plugin_CgProgramManager.dll
22:22:04: Installing plugin: Cg Program Manager
22:22:04: Plugin successfully installed
22:22:04: Loading library D:/OGRE2/Built/ogre-1.12.9/bin\Codec_STBI.dll
22:22:04: stb_image - v2.23 - public domain image loader
22:22:04: Supported formats: jpeg,jpg,png,bmp,psd,tga,gif,pic,ppm,pgm,hdr
22:22:04: *-*-* OGRE Initialising
22:22:04: *-*-* Version 1.12.9 (Rhagorthua)
22:22:04: Creating resource group Essential
22:22:04: Added resource location 'D:\OGRE\media\packs\SdkTrays.zip' of type 'Zip' to resource group 'Essential'
22:22:04: Creating resource group GUI
22:22:04: Added resource location 'D:\OGRE2\Built\mygui-master\Media\MyGUI_Media' of type 'FileSystem' to resource group 'GUI'
22:22:04: Added resource location 'D:\OGRE\media' of type 'FileSystem' to resource group 'General'
22:22:04: Added resource location 'D:\OGRE\media\models' of type 'FileSystem' to resource group 'General'
22:22:04: D3D9 : RenderSystem Option: Allow DirectX9Ex = No
22:22:04: D3D9 : RenderSystem Option: Allow NVPerfHUD = No
22:22:04: D3D9 : RenderSystem Option: Backbuffer Count = Auto
22:22:04: D3D9 : RenderSystem Option: FSAA = 0
22:22:04: D3D9 : RenderSystem Option: Fixed Pipeline Enabled = Yes
22:22:04: D3D9 : RenderSystem Option: Floating-point mode = Fastest
22:22:04: D3D9 : RenderSystem Option: Full Screen = No
22:22:04: D3D9 : RenderSystem Option: Multi device memory hint = Use minimum system memory
22:22:04: D3D9 : RenderSystem Option: Rendering Device = Monitor-1-AMD Radeon(TM) RX Vega 11 Graphics
22:22:04: D3D9 : RenderSystem Option: Resource Creation Policy = Create on all devices
22:22:04: D3D9 : RenderSystem Option: Use Multihead = Auto
22:22:04: D3D9 : RenderSystem Option: VSync = Yes
22:22:04: D3D9 : RenderSystem Option: VSync Interval = 1
22:22:04: D3D9 : RenderSystem Option: Video Mode = 800 x 600 @ 32-bit colour
22:22:04: D3D9 : RenderSystem Option: sRGB Gamma Conversion = No
22:22:04: CPU Identifier & Features
22:22:04: -------------------------
22:22:04:  *   CPU ID: AuthenticAMD: AMD Ryzen 5 3400G with Radeon Vega Graphics
22:22:04:  *          SSE: yes
22:22:04:  *         SSE2: yes
22:22:04:  *         SSE3: yes
22:22:04:  *        SSE41: no
22:22:04:  *        SSE42: no
22:22:04:  *          MMX: yes
22:22:04:  *       MMXEXT: yes
22:22:04:  *        3DNOW: no
22:22:04:  *     3DNOWEXT: no
22:22:04:  *         CMOV: yes
22:22:04:  *          TSC: yes
22:22:04:  *INVARIANT TSC: yes
22:22:04:  *          FPU: yes
22:22:04:  *          PRO: yes
22:22:04:  *           HT: no
22:22:04: -------------------------
22:22:04: D3D9 : Subsystem Initialising
22:22:04: Registering ResourceManager for type Texture
22:22:04: Registering ResourceManager for type GpuProgram
22:22:04: ***************************************
22:22:04: *** D3D9 : Subsystem Initialised OK ***
22:22:04: ***************************************
22:22:04: RenderSystem::_createRenderWindow "MinimalOgre Render Window", 800x600 windowed  miscParams: FSAA=0 colourDepth=32 gamma=No monitorIndex=1 vsync=Yes vsyncInterval=1 
22:22:04: D3D9 : Created D3D9 Rendering Window 'MinimalOgre Render Window' : 800x600, 32bpp
22:22:04: D3D9: Vertex texture format supported - PF_L8
22:22:04: D3D9: Vertex texture format supported - PF_L16
22:22:04: D3D9: Vertex texture format supported - PF_A8
22:22:04: D3D9: Vertex texture format supported - PF_BYTE_LA
22:22:04: D3D9: Vertex texture format supported - PF_R5G6B5
22:22:04: D3D9: Vertex texture format supported - PF_A4R4G4B4
22:22:04: D3D9: Vertex texture format supported - PF_A1R5G5B5
22:22:04: D3D9: Vertex texture format supported - PF_A8R8G8B8
22:22:04: D3D9: Vertex texture format supported - PF_A2R10G10B10
22:22:04: D3D9: Vertex texture format supported - PF_A2B10G10R10
22:22:04: D3D9: Vertex texture format supported - PF_DXT1
22:22:04: D3D9: Vertex texture format supported - PF_DXT2
22:22:04: D3D9: Vertex texture format supported - PF_DXT3
22:22:04: D3D9: Vertex texture format supported - PF_DXT4
22:22:04: D3D9: Vertex texture format supported - PF_DXT5
22:22:04: D3D9: Vertex texture format supported - PF_FLOAT16_RGBA
22:22:04: D3D9: Vertex texture format supported - PF_FLOAT32_RGBA
22:22:04: D3D9: Vertex texture format supported - PF_X8R8G8B8
22:22:04: D3D9: Vertex texture format supported - PF_X8B8G8R8
22:22:04: D3D9: Vertex texture format supported - PF_SHORT_RGBA
22:22:04: D3D9: Vertex texture format supported - PF_FLOAT16_R
22:22:04: D3D9: Vertex texture format supported - PF_FLOAT32_R
22:22:04: D3D9: Vertex texture format supported - PF_SHORT_GR
22:22:04: D3D9: Vertex texture format supported - PF_FLOAT16_GR
22:22:04: D3D9: Vertex texture format supported - PF_FLOAT32_GR
22:22:04: RenderSystem capabilities
22:22:04: -------------------------
22:22:04: RenderSystem Name: Direct3D9 Rendering Subsystem
22:22:04: GPU Vendor: amd
22:22:04: Device Name: Monitor-1-AMD Radeon(TM) RX Vega 11 Graphics
22:22:04: Driver Version: 27.20.1020.1
22:22:04:  * Fixed function pipeline: yes
22:22:04:  * 32-bit index buffers: yes
22:22:04:  * Hardware stencil buffer: yes
22:22:04:    - Stencil depth: 8
22:22:04:    - Two sided stencil support: yes
22:22:04:    - Wrap stencil values: yes
22:22:04:  * Vertex programs: yes
22:22:04:    - Number of floating-point constants: 256
22:22:04:    - Number of integer constants: 16
22:22:04:    - Number of boolean constants: 16
22:22:04:  * Fragment programs: yes
22:22:04:    - Number of floating-point constants: 224
22:22:04:    - Number of integer constants: 16
22:22:04:    - Number of boolean constants: 16
22:22:04:  * Geometry programs: no
22:22:04:  * Tessellation Hull programs: no
22:22:04:  * Tessellation Domain programs: no
22:22:04:  * Compute programs: no
22:22:04:  * Supported Shader Profiles: hlsl ps_1_1 ps_1_2 ps_1_3 ps_1_4 ps_2_0 ps_2_a ps_2_b ps_3_0 vs_1_1 vs_2_0 vs_2_a vs_3_0
22:22:04:  * Read-back compiled shader: yes
22:22:04:  * Number of vertex attributes: 14
22:22:04:  * Textures
22:22:04:    - Number of texture units: 8
22:22:04:    - Floating point: yes
22:22:04:    - Non-power-of-two: yes
22:22:04:    - 1D textures: yes
22:22:04:    - 2D array textures: no
22:22:04:    - 3D textures: yes
22:22:04:    - Anisotropic filtering: yes
22:22:04:  * Texture Compression: yes
22:22:04:    - DXT: yes
22:22:04:    - VTC: no
22:22:04:    - PVRTC: no
22:22:04:    - ATC: no
22:22:04:    - ETC1: no
22:22:04:    - ETC2: no
22:22:04:    - BC4/BC5: no
22:22:04:    - BC6H/BC7: no
22:22:04:    - ASTC: no
22:22:04:    - Mipmaps for compressed formats: no
22:22:04:  * Vertex Buffers
22:22:04:    - VET_UBYTE4 element type: yes
22:22:04:    - Render to Vertex Buffer: no
22:22:04:    - Instance Data: yes
22:22:04:    - Primitive Restart: no
22:22:04:  * Vertex texture fetch: yes
22:22:04:    - Max vertex textures: 4
22:22:04:    - Vertex textures shared: no
22:22:04:  * Read/Write Buffers: no
22:22:04:  * Hardware Occlusion Query: yes
22:22:04:  * User clip planes: yes
22:22:04:  * Infinite far plane projection: yes
22:22:04:  * Hardware render-to-texture: yes
22:22:04:    - Multiple Render Targets: 4
22:22:04:    - With different bit depths: yes
22:22:04:  * Point Sprites: yes
22:22:04:    - Extended parameters: yes
22:22:04:    - Max Size: 256
22:22:04:  * Wide Lines: no
22:22:04:  * Hardware Gamma: no
22:22:04:  * DirectX per stage constants: yes
22:22:04:  * W-Buffer supported: no
22:22:04: DefaultWorkQueue('Root') initialising on thread 1.
22:22:04: Particle Renderer Type 'billboard' registered
22:22:04: DefaultWorkQueue('Root')::WorkerFunc - thread 2 starting.
22:22:04: DefaultWorkQueue('Root')::WorkerFunc - thread 3 starting.
22:22:04: Parsing scripts for resource group Essential
22:22:04: Parsing script SdkTrays.material
22:22:04: Finished parsing scripts for resource group Essential
22:22:04: Creating resources for group Essential
22:22:04: All done
22:22:04: Parsing scripts for resource group GUI
22:22:04: Finished parsing scripts for resource group GUI
22:22:04: Creating resources for group GUI
22:22:04: All done
22:22:04: Parsing scripts for resource group General
22:22:04: Parsing script Material.material
22:22:04: Parsing script Sapphire.material
22:22:04: Parsing script Cube.material
22:22:04: Parsing script Glow.material
22:22:04: Parsing script ninja.material
22:22:04: Parsing script Rock.material
22:22:04: Parsing script Sphere.material
22:22:04: Finished parsing scripts for resource group General
22:22:04: Creating resources for group General
22:22:04: All done
22:22:04: Parsing scripts for resource group OgreAutodetect
22:22:04: Finished parsing scripts for resource group OgreAutodetect
22:22:04: Creating resources for group OgreAutodetect
22:22:04: All done
22:22:04: Parsing scripts for resource group OgreInternal
22:22:04: Finished parsing scripts for resource group OgreInternal
22:22:04: Creating resources for group OgreInternal
22:22:04: All done
22:22:04: Mesh: Loading Sphere.mesh.
22:22:04: Warning: Sphere.mesh uses an old format [MeshSerializer_v1.8]; upgrade with the OgreMeshUpgrader tool
22:22:04: Error: preparing texture '100_1449_seamless.JPG'. Texture layer will be blank: Cannot locate resource 100_1449_seamless.JPG in resource group General.
22:22:04: Can't assign material '' to SubEntity of 'Sphere' because this Material does not exist in group 'OgreAutodetect'. Have you forgotten to define it in a .material script?
22:22:04: *** Initializing OIS ***
MyGUI.log:

Code: Select all

22:22:04  |  Platform  |  Info  |  * Initialise: DataManager  |  D:\OGRE2\Sources\mygui-master\Platforms\Ogre\OgrePlatform\src\MyGUI_OgreDataManager.cpp  |  27
22:22:04  |  Platform  |  Info  |  DataManager successfully initialized  |  D:\OGRE2\Sources\mygui-master\Platforms\Ogre\OgrePlatform\src\MyGUI_OgreDataManager.cpp  |  35
22:22:04  |  Platform  |  Info  |  * Initialise: RenderManager  |  D:\OGRE2\Sources\mygui-master\Platforms\Ogre\OgrePlatform\src\MyGUI_OgreRenderManager.cpp  |  43
Last time I checked with OGRE 1.12.3 I think it was, the problem was that nothing was showing but now it just crashes.

I am now going to try the debug version to see if I can get more info.
User avatar
sercero
Bronze Sponsor
Bronze Sponsor
Posts: 449
Joined: Sun Jan 18, 2015 4:20 pm
Location: Buenos Aires, Argentina
x 156

Re: [1.12.0] MyGUI not rendered with DX9

Post by sercero »

Tried the debug version and it crashes here:

Code: Select all

In Ogre::D3D9HLSLProgram::compileMicrocode() () (D:\OGRE2\Built\ogre-1.12.9\bin\RenderSystem_Direct3D9.dll)
It seems there is some problem with the shaders that are now part of MyGUI, is anyone able to tell if there is something in these HLSL shaders that could make OGRE crash?
MyGUI_Ogre_FP.hlsl:

Code: Select all

void main(
	uniform Texture2D<float4> sampleTexture : register(t0),
	uniform SamplerState sampleSampler : register(s0),
	in float4 inPosition : SV_POSITION,
	in float4 inColor : TEXCOORD0,
	in float2 inTexcoord : TEXCOORD1,
	out float4 Out : SV_TARGET )
{
	Out = sampleTexture.SampleLevel(sampleSampler, inTexcoord, 0).rgba * inColor;
}
MyGUI_Ogre_VP.hlsl:

Code: Select all

void main(
	in float3 inPosition : POSITION0,
	in float4 inColor : COLOR0,
	in float2 inTexcoord : TEXCOORD0,
	uniform float YFlipScale,
	out float4 outPosition : SV_POSITION,
	out float4 outColor : TEXCOORD0,
	out float2 outTexcoord : TEXCOORD1 )
{
	float4 vpos = float4(inPosition, 1.0f);
	vpos.y *= YFlipScale;
	outPosition = vpos;
	outColor = inColor;
	outTexcoord = inTexcoord;
}
Here is how MyGUI is registering the shader with OGRE.

Code: Select all

	OgreShaderInfo* OgreRenderManager::createShader(
		const std::string& _shaderName,
		const std::string& _vertexProgramFile,
		const std::string& _fragmentProgramFile)
	{
		OgreShaderInfo* shaderInfo = new OgreShaderInfo();

		std::string shaderLanguage = getShaderExtension();

		shaderInfo->vertexProgram = Ogre::HighLevelGpuProgramManager::getSingleton().getByName(
			_vertexProgramFile,
			OgreDataManager::getInstance().getGroup());
		if (!shaderInfo->vertexProgram)
		{
			shaderInfo->vertexProgram = Ogre::HighLevelGpuProgramManager::getSingleton().createProgram(
				_vertexProgramFile,
				OgreDataManager::getInstance().getGroup(),
				shaderLanguage,
				Ogre::GPT_VERTEX_PROGRAM);
			shaderInfo->vertexProgram->setSourceFile(_vertexProgramFile);
			if (shaderLanguage == "hlsl")
			{
				shaderInfo->vertexProgram->setParameter("target", "vs_4_0");
				shaderInfo->vertexProgram->setParameter("entry_point", "main");
			}
			shaderInfo->vertexProgram->load();
		}

		shaderInfo->fragmentProgram = Ogre::HighLevelGpuProgramManager::getSingleton().getByName(
			_fragmentProgramFile,
			OgreDataManager::getInstance().getGroup());
		if (!shaderInfo->fragmentProgram)
		{
			shaderInfo->fragmentProgram = Ogre::HighLevelGpuProgramManager::getSingleton().createProgram(
				_fragmentProgramFile,
				OgreDataManager::getInstance().getGroup(),
				shaderLanguage,
				Ogre::GPT_FRAGMENT_PROGRAM);
			shaderInfo->fragmentProgram->setSourceFile(_fragmentProgramFile);
			if (shaderLanguage == "hlsl")
			{
				shaderInfo->fragmentProgram->setParameter("target", "ps_4_0");
				shaderInfo->fragmentProgram->setParameter("entry_point", "main");
			}
			shaderInfo->fragmentProgram->load();
		}

		return shaderInfo;
	}
Is it possible that "ps_4_0" or "vs_4_0" is not supported in DirectX9?
User avatar
sercero
Bronze Sponsor
Bronze Sponsor
Posts: 449
Joined: Sun Jan 18, 2015 4:20 pm
Location: Buenos Aires, Argentina
x 156

Re: [1.12.0] MyGUI not rendered with DX9

Post by sercero »

OK, now I know that these profiles are not supported on DirectX9, it seems they belong in DirectX10:
(from ogre.log)

Code: Select all

22:22:58:  * Supported Shader Profiles: hlsl ps_1_1 ps_1_2 ps_1_3 ps_1_4 ps_2_0 ps_2_a ps_2_b ps_3_0 vs_1_1 vs_2_0 vs_2_a vs_3_0
When setting the targets manually to "ps_3_0" and "vs_3_0", now there is no crash but the GUI does not show on the screen.

I already requested help on the MyGUI forums: https://github.com/MyGUI/mygui/issues/179.

Could someone help me translating these shaders from "ps_4_0" and "vs_4_0" to "ps_3_0" and "vs_3_0"?

Thanks in advance.
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: [1.12.0] MyGUI not rendered with DX9

Post by paroj »

try

Code: Select all

void main(
	uniform sampler2D sampleTexture : register(s0),
	in float4 inPosition : POSITION,
	in float4 inColor : TEXCOORD0,
	in float2 inTexcoord : TEXCOORD1,
	out float4 Out : COLOR )
{
	Out = tex2D(sampleTexture, inTexcoord) * inColor;
}
User avatar
sercero
Bronze Sponsor
Bronze Sponsor
Posts: 449
Joined: Sun Jan 18, 2015 4:20 pm
Location: Buenos Aires, Argentina
x 156

Re: [1.12.0] MyGUI not rendered with DX9

Post by sercero »

It works!

Thanks a lot paroj.
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: [1.12.0] MyGUI not rendered with DX9

Post by paroj »

fun fact:

these shaders are equivalent to

Code: Select all

pass
{
	diffuse vertexcolour
	texture_unit
	{
		...
	}
}
and could be easily auto-generated for D3D11 by the RTSS.
User avatar
sercero
Bronze Sponsor
Bronze Sponsor
Posts: 449
Joined: Sun Jan 18, 2015 4:20 pm
Location: Buenos Aires, Argentina
x 156

Re: [1.12.0] MyGUI not rendered with DX9

Post by sercero »

I imagined those were pretty simple shaders.

My knowledge for now is very limited, but the idea is to learn shaders eventually.

Since the shaders are so basic I don't think that using the RTSS is justified in this case.

Anyway it would be @altren's decision, I'm just a user of MyGUI.
User avatar
sercero
Bronze Sponsor
Bronze Sponsor
Posts: 449
Joined: Sun Jan 18, 2015 4:20 pm
Location: Buenos Aires, Argentina
x 156

Re: [1.12.0] MyGUI not rendered with DX9

Post by sercero »

Since we are at it, @paroj could you help with something else?

With the latest MyGUI (from master), and OGRE 1.12.9 the OpenGL RenderSystem gives the following error message in ogre.log:

Code: Select all

11:28:19: Error prior to using GLSL Program Object : GL_INVALID_VALUE
Validation warning! - Sampler value sampleTexture has not been set.
Validation successful.
The shader works anyway because the GUI is showing, but the log gets filled with messages like these and the FPS drop considerably.

Here is the Fragment Program:

Code: Select all

#version 130

precision highp int;
precision highp float;

uniform sampler2D sampler;

in vec4 outUV0;
in vec4 outColor;

// Texturing fragment program for GLSL ES
void main()
{
	gl_FragColor = outColor * texture(sampler, outUV0.xy);
}
It seems that MyGUI is not passing the "sampler" to the fragment program, it is my understanding that they are using an RTT to render the GUI.
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: [1.12.0] MyGUI not rendered with DX9

Post by paroj »

sercero wrote: Mon Nov 09, 2020 4:32 pm It seems that MyGUI is not passing the "sampler" to the fragment program,
yes, this is probably the reason. Try adding

Code: Select all

params->setNamedConstant("sampler", 0);
to the fragment shader params.
User avatar
sercero
Bronze Sponsor
Bronze Sponsor
Posts: 449
Joined: Sun Jan 18, 2015 4:20 pm
Location: Buenos Aires, Argentina
x 156

Re: [1.12.0] MyGUI not rendered with DX9

Post by sercero »

Thanks, I tried that already but it didn't work.

Most likely because I was doing it in the wrong place.

But now I know that I was on the right path.

Thanks again.
Post Reply