mirror of
https://github.com/minetest/irrlicht.git
synced 2024-11-10 09:43:52 +01:00
Vertex texture sampling support in Direct3D 9 now controlled via texture-flag ETCF_SUPPORT_VERTEXT_TEXTURE
It's no longer enabled by default as it causes some costs to all texture switches. Thanks @ edo9300 for reporting (http://irrlicht.sourceforge.net/forum/viewtopic.php?f=7&t=52721) git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6219 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
parent
ca48a1ac69
commit
224d7c5e2c
@ -1,5 +1,7 @@
|
|||||||
--------------------------
|
--------------------------
|
||||||
Changes in 1.9 (not yet released)
|
Changes in 1.9 (not yet released)
|
||||||
|
- Add ETCF_SUPPORT_VERTEXT_TEXTURE flag which can be used to enable vertex texture sampling support in Direct3D 9.
|
||||||
|
Note that this was enabled for a long time in 1.9 svn, but is now disabled by default.
|
||||||
- CGUIListBox now serializes the state of "Selected". Feature wish by chronologicaldot (http://irrlicht.sourceforge.net/forum/viewtopic.php?f=2&t=52719)
|
- CGUIListBox now serializes the state of "Selected". Feature wish by chronologicaldot (http://irrlicht.sourceforge.net/forum/viewtopic.php?f=2&t=52719)
|
||||||
- Bugfix: Changing focus with tab-keys now also work when elements are inside a modal screen.
|
- Bugfix: Changing focus with tab-keys now also work when elements are inside a modal screen.
|
||||||
- COBJMeshFileLoader using a bit more exact color conversion for 0-1 to 0-255 range (same now as SColorf::toSColor uses).
|
- COBJMeshFileLoader using a bit more exact color conversion for 0-1 to 0-255 range (same now as SColorf::toSColor uses).
|
||||||
|
@ -97,6 +97,14 @@ enum E_TEXTURE_CREATION_FLAG
|
|||||||
*/
|
*/
|
||||||
ETCF_AUTO_GENERATE_MIP_MAPS = 0x00000100,
|
ETCF_AUTO_GENERATE_MIP_MAPS = 0x00000100,
|
||||||
|
|
||||||
|
//! Enable support for vertex shader texture sampling on some drivers
|
||||||
|
/** Default is false.
|
||||||
|
This adds a small costs to all texture switches.
|
||||||
|
Currently only affects D3D9.
|
||||||
|
On OpenGL vertex shaders use the same texture unit as pixel shaders, so support there only depends on GL version and not on this flag
|
||||||
|
*/
|
||||||
|
ETCF_SUPPORT_VERTEXT_TEXTURE = 0x00000200,
|
||||||
|
|
||||||
/** This flag is never used, it only forces the compiler to compile
|
/** This flag is never used, it only forces the compiler to compile
|
||||||
these enumeration values to 32 bit. */
|
these enumeration values to 32 bit. */
|
||||||
ETCF_FORCE_32_BIT_DO_NOT_USE = 0x7fffffff
|
ETCF_FORCE_32_BIT_DO_NOT_USE = 0x7fffffff
|
||||||
|
@ -698,12 +698,6 @@ bool CD3D9Driver::setActiveTexture(u32 stage, const video::ITexture* texture)
|
|||||||
if (CurrentTexture[stage] == texture)
|
if (CurrentTexture[stage] == texture)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (texture && texture->getDriverType() != EDT_DIRECT3D9)
|
|
||||||
{
|
|
||||||
os::Printer::log("Fatal Error: Tried to set a texture not owned by this driver.", ELL_ERROR);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
CurrentTexture[stage] = texture;
|
CurrentTexture[stage] = texture;
|
||||||
|
|
||||||
if (!texture)
|
if (!texture)
|
||||||
@ -711,13 +705,20 @@ bool CD3D9Driver::setActiveTexture(u32 stage, const video::ITexture* texture)
|
|||||||
pID3DDevice->SetTexture(stage, 0);
|
pID3DDevice->SetTexture(stage, 0);
|
||||||
pID3DDevice->SetTextureStageState( stage, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE );
|
pID3DDevice->SetTextureStageState( stage, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE );
|
||||||
}
|
}
|
||||||
else
|
else if (texture->getDriverType() == EDT_DIRECT3D9)
|
||||||
{
|
{
|
||||||
pID3DDevice->SetTexture(stage, ((const CD3D9Texture*)texture)->getDX9BaseTexture());
|
pID3DDevice->SetTexture(stage, ((const CD3D9Texture*)texture)->getDX9BaseTexture());
|
||||||
|
|
||||||
if (stage <= 4)
|
if (((const CD3D9Texture*)texture)->HasVertexTextureSupport() && stage < 4 )
|
||||||
pID3DDevice->SetTexture(D3DVERTEXTEXTURESAMPLER0 + stage, ((const CD3D9Texture*)texture)->getDX9BaseTexture());
|
pID3DDevice->SetTexture(D3DVERTEXTEXTURESAMPLER0 + stage, ((const CD3D9Texture*)texture)->getDX9BaseTexture());
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
os::Printer::log("Fatal Error: Tried to set a texture not owned by this driver.", ELL_ERROR);
|
||||||
|
setActiveTexture(stage, 0);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,17 +38,19 @@ CD3D9Texture::CD3D9Texture(const io::path& name, const core::array<IImage*>& ima
|
|||||||
|
|
||||||
DWORD flags = 0;
|
DWORD flags = 0;
|
||||||
|
|
||||||
|
LPDIRECT3D9 intf = Driver->getExposedVideoData().D3D9.D3D9;
|
||||||
|
D3DDISPLAYMODE d3ddm;
|
||||||
|
intf->GetAdapterDisplayMode(Driver->Params.DisplayAdapter, &d3ddm);
|
||||||
if (HasMipMaps && HardwareMipMaps)
|
if (HasMipMaps && HardwareMipMaps)
|
||||||
{
|
{
|
||||||
LPDIRECT3D9 intf = Driver->getExposedVideoData().D3D9.D3D9;
|
|
||||||
D3DDISPLAYMODE d3ddm;
|
|
||||||
intf->GetAdapterDisplayMode(Driver->Params.DisplayAdapter, &d3ddm);
|
|
||||||
|
|
||||||
if (D3D_OK == intf->CheckDeviceFormat(Driver->Params.DisplayAdapter, D3DDEVTYPE_HAL, d3ddm.Format, D3DUSAGE_AUTOGENMIPMAP, D3DRTYPE_TEXTURE, InternalFormat))
|
if (D3D_OK == intf->CheckDeviceFormat(Driver->Params.DisplayAdapter, D3DDEVTYPE_HAL, d3ddm.Format, D3DUSAGE_AUTOGENMIPMAP, D3DRTYPE_TEXTURE, InternalFormat))
|
||||||
flags = D3DUSAGE_AUTOGENMIPMAP;
|
flags = D3DUSAGE_AUTOGENMIPMAP;
|
||||||
else
|
else
|
||||||
HardwareMipMaps = false;
|
HardwareMipMaps = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VertexTextureSupport = Driver->getTextureCreationFlag(ETCF_SUPPORT_VERTEXT_TEXTURE)
|
||||||
|
&& (D3D_OK == intf->CheckDeviceFormat(Driver->Params.DisplayAdapter, D3DDEVTYPE_HAL, d3ddm.Format, D3DUSAGE_QUERY_VERTEXTEXTURE, D3DRTYPE_TEXTURE, InternalFormat));
|
||||||
|
|
||||||
HRESULT hr = 0;
|
HRESULT hr = 0;
|
||||||
|
|
||||||
|
@ -42,6 +42,11 @@ public:
|
|||||||
IDirect3DTexture9* getDX9Texture() const;
|
IDirect3DTexture9* getDX9Texture() const;
|
||||||
IDirect3DCubeTexture9* getDX9CubeTexture() const;
|
IDirect3DCubeTexture9* getDX9CubeTexture() const;
|
||||||
|
|
||||||
|
inline bool HasVertexTextureSupport() const
|
||||||
|
{
|
||||||
|
return VertexTextureSupport;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class CD3D9Driver;
|
friend class CD3D9Driver;
|
||||||
|
|
||||||
@ -77,6 +82,7 @@ private:
|
|||||||
u32 MipLevelLocked;
|
u32 MipLevelLocked;
|
||||||
|
|
||||||
bool HardwareMipMaps;
|
bool HardwareMipMaps;
|
||||||
|
bool VertexTextureSupport;
|
||||||
|
|
||||||
IDirect3DDevice9* Device;
|
IDirect3DDevice9* Device;
|
||||||
IDirect3DTexture9* Texture;
|
IDirect3DTexture9* Texture;
|
||||||
|
Loading…
Reference in New Issue
Block a user