Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
GLES2 and D3D11 port
Clone this wiki locally
Changes in API/Pipeline
- bool h3dInit(void* device)
h3dInit now has a parameter. On D3D11 pass a valid ID3D11Device device. On other platform pass 0x0.
new API: int h3dGetCaps( H3DCaps::List param ) and H3DCaps::List enum to query certain device capabilities: compressed texture format support, depth/shadow texture support, floating point texture support, mrt support, ... . Based on this the appropriate texture format can be loaded from assets or a supported pipeline can be selected at runtime.
Removed ResourceFlags::NoTexCompression, EngineOptions::TexCompression from the API and Sampler's allowCompression flag in material. Texture compression may be done in a preprocessing step or moved to a separate utility library that creates compressed textures on the fly and pass those to horde. Note: The compression wasn't working in the current OpenGL backend.
Changed TextureFormat H3DFormats::TEX_BGRA8 to H3DFormats::TEX_RGBA8 (and TextureFormats::BGRA8888 to TextureFormats::RGBA8888). Rationale: ES2 has no BGRA8888 format. Extensions like EXT_texture_format_BGRA8888 and GL_APPLE_texture_format_BGRA8888 adds support for this (but this is missing on some platform). I benchmarked rgba/bgra texture upload on iOS (powervr sgx 535,543), android (powervr sgx 540, mali400, adreno 205/220/320, tegra3) and there was no noticable difference in speed. Changing to rgba8 makes stbi texture upload faster (there is no need for CPU swizzling of texture). Volker on desktopGL: "I never noticed any measurable difference in speed and for texture streaming - between bgra8 vs rgba8 - maybe PBOs would make a bigger difference, but are currently not used by Horde3D."
Added PVRTCI and ETC1 texture format support
Added PVR,KTX file format support
D3D11 specific changes
- D3D11 attribute->semantic mapping. I can't get the name of the attribute/vertex input element name in D3D11. So h3d attribute names are mapped to d3d11 semantics. vertPos -> POSITION0, texCoords0 -> TEXCOORD0, texCoords1 -> TEXCOORD1, normal -> NORMAL0, tangent -> TANGENT0, joints -> BLENDINDICES0, weights -> BLENDWEIGHTS0, parIdx -> BLENDINDICES0. So for example
//GL definition attribute vec3 vertPos; //d3d11 definition float3 vertPos : POSITION0; // name of variable ('vertPos' in previous definition) doesn't matter, so one can use something like this too but I keep it to ease porting the shaders float3 vertexPosition : POSITION0;
- D3D11 samplers/textures are separate objects. I use name convention to link them: "sampler_" and "texture_" prefix for the names. For example
//definition and sampling in GL uniform sampler2D albedoMap; vec4 albedo = texture2D( albedoMap, newCoords.st ); // definition and sampling in D3D11 Texture2D texture_albedoMap; SamplerState sampler_albedoMap; float4 albedo = texture_albedoMap.Sample( sampler_albedoMap, newCoords.xy );
- add query for current renderer backend
- Testing, Testing, Testing,... Create a Regression test app
- Add formats etc2_atc, astc, bc4-7
- SkipMipLevel option
- GLES2: add multisampling using APPLE_framebuffer_multisample.
- GLES2: add tex/rt float support with use OES_texture_float_linear, OES_texture_half_float_linear, OES_texture_float, OES_texture_half_float, EXT_color_buffer_half_float, EXT_color_buffer_float
- GLES2: add non-power-of-two support with GL_OES_texture_npot
- GLES2: srgb support with EXT_sRGB
- GLES2: add EXT_disjoint_timer_query support