Dx9 sm3 or not?

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
Post Reply
Granyte
Posts: 850
Joined: Tue Jan 25, 2011 11:07 pm
Contact:

Dx9 sm3 or not?

Post by Granyte »

I'm wondering if the current dx9 driver is actualy using dx9.0c.
Why i'm wondering this is because there is a hard cap of 8 texture units in dx9 pixel shader even if the standar say there should be 16 and vertex shader are not working in irrlicht even if they should
Granyte
Posts: 850
Joined: Tue Jan 25, 2011 11:07 pm
Contact:

Re: Dx9 sm3 or not?

Post by Granyte »

alright after a quick search i found that the device caps max simulatanous texture was relevant only for fixed pipeline and that when we are using shaders the real cap is somewhere between 16 an 32 depending on the hardware. i had to make a couple line modification to irrlicht and i can now use 16 texture in dx9


here are the changes


in IVideoDriver.h line 53
the enum E_TRANSFORMATION_STATE
needs to be extended (in dx9 it caused no crashes it was simply impossible to run with 16 texture without this but with my dx10 driver using more then 8 texture without modifiying this caused heavy crashes.)

Code: Select all

//! View transformation
        ETS_VIEW = 0,
        //! World transformation
        ETS_WORLD,
        //! Projection transformation
        ETS_PROJECTION,
        //! Texture transformation
        ETS_TEXTURE_0,
        //! Texture transformation
        ETS_TEXTURE_1,
        //! Texture transformation
        ETS_TEXTURE_2,
        //! Texture transformation
        ETS_TEXTURE_3,
#if _IRR_MATERIAL_MAX_TEXTURES_>4
        //! Texture transformation
        ETS_TEXTURE_4,
#if _IRR_MATERIAL_MAX_TEXTURES_>5
        //! Texture transformation
        ETS_TEXTURE_5,
#if _IRR_MATERIAL_MAX_TEXTURES_>6
        //! Texture transformation
        ETS_TEXTURE_6,
#if _IRR_MATERIAL_MAX_TEXTURES_>7
        //! Texture transformation
        ETS_TEXTURE_7,
#if _IRR_MATERIAL_MAX_TEXTURES_>8
        //! Texture transformation
        ETS_TEXTURE_8,
#if _IRR_MATERIAL_MAX_TEXTURES_>9
        //! Texture transformation
        ETS_TEXTURE_9,
#if _IRR_MATERIAL_MAX_TEXTURES_>10
        //! Texture transformation
        ETS_TEXTURE_10,
#if _IRR_MATERIAL_MAX_TEXTURES_>11
        //! Texture transformation
        ETS_TEXTURE_11,
#if _IRR_MATERIAL_MAX_TEXTURES_>12
        //! Texture transformation
        ETS_TEXTURE_12,
#if _IRR_MATERIAL_MAX_TEXTURES_>13
        //! Texture transformation
        ETS_TEXTURE_13,
#if _IRR_MATERIAL_MAX_TEXTURES_>14
        //! Texture transformation
        ETS_TEXTURE_14,
#if _IRR_MATERIAL_MAX_TEXTURES_>15
        //! Texture transformation
        ETS_TEXTURE_15,
the enum should probably be extended to 32 simply to avoid having a hidden limitatin there


in CD3D9Driver.cpp line 461
the line

Code: Select all

MaxTextureUnits = core::min_((u32)Caps.MaxSimultaneousTextures, MATERIAL_MAX_TEXTURES);
need to be replaced with

Code: Select all

MaxTextureUnits = MATERIAL_MAX_TEXTURES;
So what do you guys think about this modification? Anychance it could be integrated in irrlicht?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Dx9 sm3 or not?

Post by hybrid »

I started a similar change in OpenGL just recently, due to similar limitations. Guess we have to synchronize these things and have similar results on both drivers in the end.
Granyte
Posts: 850
Joined: Tue Jan 25, 2011 11:07 pm
Contact:

Re: Dx9 sm3 or not?

Post by Granyte »

well thell me what you added to the openGL cause for dx this is everything that was needed
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Dx9 sm3 or not?

Post by Mel »

And why not simply, prepare irr for 16 textures by default? older hardware won't be able to set the highest texture stages, but the new hard shouldn't be capped this way with irr.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Granyte
Posts: 850
Joined: Tue Jan 25, 2011 11:07 pm
Contact:

Re: Dx9 sm3 or not?

Post by Granyte »

Honestly we should just skip straight to 32 for new hardware this is the real cap.

And unless someone is using the fixed pipeline every hardware all the way dow to sm2 should be able to use all 16
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Dx9 sm3 or not?

Post by Nadro »

Or even 64 for mostly (all?) DX11 hardware :P

Now, seriously :) I think that 16-32 is an optimal number which should be enabled default in Irrlicht, because current 4 textures is a strange limitation. Of course changes will not be included in 1.8, but in 1.9 we should change limit of textures I think.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Granyte
Posts: 850
Joined: Tue Jan 25, 2011 11:07 pm
Contact:

Re: Dx9 sm3 or not?

Post by Granyte »

at this point indeed ya we should go straight for the 64 limit instead of waking up in a couple month then patch it again
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Dx9 sm3 or not?

Post by hybrid »

There is no 4 texture limit in Irrlicht. You can go up to any number you want. But due to different caps used, most gfx cards report these low values. Next thing, once we change the caps, there's again no limit to any number. The limit is only defined by the texture matrices used in SMaterial. And we won't allow for such large numbers anyway, so there will be a change in the numbering scheme of the enum to allow arbitrary numbers of texture matrices.
Granyte
Posts: 850
Joined: Tue Jan 25, 2011 11:07 pm
Contact:

Re: Dx9 sm3 or not?

Post by Granyte »

I expanded the texture define to the maximum on my custom version and the maximum that can be enabeled in dx9 is 16

if we keep using the current way of setting the texture at the same time we set the sampler and this limitation will remain in dx11 and 10 as there is only 16 sampler register even if some dx10 and 11 hardware can handle up to 128 texture.
Post Reply