Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(4158)

Issue 6492098: Fix bug 368: Specify the Levels parameter of CreateCubeTexture and CreateTexture correctly.

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 7 months ago by sminns
Modified:
11 years, 7 months ago
Reviewers:
dgkoch, nicolas, John Bauman
CC:
angleproject-review_googlegroups.com
Base URL:
http://angleproject.googlecode.com/svn/trunk/
Visibility:
Public.

Description

Fix bug 368: Specify the Levels parameter of CreateCubeTexture and CreateTexture correctly. This fixes ATS test cases 38840,38841 (while making sure that 44095, 44096, 44097, 44100, 44101, 44102 still work) The Direct3D spec for the 'Levels' parameter of IDirect3DDevice9::CreateCubeTexture (and IDirect3DDevice9::CreateTexture) says: "If this is zero, Direct3D will generate all cube texture sublevels down to 1x1 pixels for each face for hardware that supports mipmapped cube textures." The 'levels' parameter can be 0 (which means "generate all texture sublevels") or a non-zero value for the actual number of levels to create (often 1 if mapmapping is disabled). But 1x1 and 2x2 mipmapped textures are not supported, so textures with these dimensions will actually create a 4x4 texture, and set mLodOffset to 2 or 1 respectively so that the level index can be offset as appropriate. There is only one special case (for textures with dimensions smaller than 4): when levels=1 and the texture is 2x2, it is unnecessary to create all miplevels, since the 1x1 texture will never be used. For all other cases, all miplevels must be generated even though the upper ones will be unused in order to generate the lower ones. If 'levels' is zero all miplevels must always be generated. It's important to preserve the special case, to ensure that attempting to access the non-existant level produces the correct error. So if 'levels' is zero, the 'Levels' parameter should always be zero, otherwise it's the sum of 'levels + mLodOffset' Also, the calls to 'creationLevels' from the TextureCubeMap methods were not quite right. Passing a zero for the second parameter causes this API to always fail, since '0' is not a power of two. There is already a version of 'creationLevels' that takes just one parameter and works correctly, so just deleting the extra parameter fixes this problem. BUG=https://code.google.com/p/angleproject/issues/detail?id=368 TEST=Run test cases 38840, 38841, 44095, 44096, 44097, 44100, 44101, 44102 in http://ats.macromedia.com/Players/ATS/ATS10AS3/Staging/ATS.html?dynamicXML=false&wmode=direct&section=Manual&xmlSetURL=http://fpqa.macromedia.com/crospepperbuild/XMLSets/ATS10AS3ManualPepper.xml Review URL: https://codereview.appspot.com/6492098

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+4 lines, -4 lines) Patch
M src/libGLESv2/Texture.cpp View 4 chunks +4 lines, -4 lines 0 comments Download

Messages

Total messages: 3
sminns
For your edification, here are all the cases: 1) If levels=1, and the texture is ...
11 years, 7 months ago (2012-09-10 18:50:00 UTC) #1
dgkoch
11 years, 7 months ago (2012-09-11 13:57:20 UTC) #2
dgkoch
11 years, 7 months ago (2012-09-11 20:25:33 UTC) #3
On 2012/09/11 13:57:20, dgkoch wrote:

LGTM.  Don't forget to bump version.h as well.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b