Renamed and reorganized the vertex conversion tables in VertexBuffer9.

TRAC #22552 Signed-off-by: Jamie Madill Signed-off-by: Nicolas Capens Author: Geoff Lang git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1909 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 5b2d855f
......@@ -17,8 +17,8 @@
namespace rx
{
bool VertexBuffer9::mAttributeTypesInitialized = false;
VertexBuffer9::FormatConverter VertexBuffer9::mAttributeTypes[NUM_GL_VERTEX_ATTRIB_TYPES][2][4];
bool VertexBuffer9::mTranslationsInitialized = false;
VertexBuffer9::FormatConverter VertexBuffer9::mFormatConverters[NUM_GL_VERTEX_ATTRIB_TYPES][2][4];
VertexBuffer9::VertexBuffer9(rx::Renderer9 *const renderer) : mRenderer(renderer)
{
......@@ -26,10 +26,10 @@ VertexBuffer9::VertexBuffer9(rx::Renderer9 *const renderer) : mRenderer(renderer
mBufferSize = 0;
mDynamicUsage = false;
if (!mAttributeTypesInitialized)
if (!mTranslationsInitialized)
{
initializeTranslations(renderer->getCapsDeclTypes());
mAttributeTypesInitialized = true;
mTranslationsInitialized = true;
}
}
......@@ -437,11 +437,11 @@ void VertexBuffer9::initializeTranslations(DWORD declTypes)
{
if (mPossibleTranslations[i][j][k].capsFlag == 0 || (declTypes & mPossibleTranslations[i][j][k].capsFlag) != 0)
{
mAttributeTypes[i][j][k] = mPossibleTranslations[i][j][k].preferredConversion;
mFormatConverters[i][j][k] = mPossibleTranslations[i][j][k].preferredConversion;
}
else
{
mAttributeTypes[i][j][k] = mPossibleTranslations[i][j][k].fallbackConversion;
mFormatConverters[i][j][k] = mPossibleTranslations[i][j][k].fallbackConversion;
}
}
}
......@@ -465,7 +465,7 @@ unsigned int VertexBuffer9::typeIndex(GLenum type)
const VertexBuffer9::FormatConverter &VertexBuffer9::formatConverter(const gl::VertexAttribute &attribute)
{
return mAttributeTypes[typeIndex(attribute.mType)][attribute.mNormalized][attribute.mSize - 1];
return mFormatConverters[typeIndex(attribute.mType)][attribute.mNormalized][attribute.mSize - 1];
}
unsigned int VertexBuffer9::spaceRequired(const gl::VertexAttribute &attrib, std::size_t count, GLsizei instances)
......
......@@ -54,6 +54,8 @@ class VertexBuffer9 : public VertexBuffer
bool mDynamicUsage;
// Attribute format conversion
enum { NUM_GL_VERTEX_ATTRIB_TYPES = 6 };
struct FormatConverter
{
bool identity;
......@@ -62,10 +64,11 @@ class VertexBuffer9 : public VertexBuffer
D3DDECLTYPE d3dDeclType;
};
enum { NUM_GL_VERTEX_ATTRIB_TYPES = 6 };
static bool mTranslationsInitialized;
static void initializeTranslations(DWORD declTypes);
static bool mAttributeTypesInitialized;
static FormatConverter mAttributeTypes[NUM_GL_VERTEX_ATTRIB_TYPES][2][4]; // [GL types as enumerated by typeIndex()][normalized][size - 1]
// [GL types as enumerated by typeIndex()][normalized][size - 1]
static FormatConverter mFormatConverters[NUM_GL_VERTEX_ATTRIB_TYPES][2][4];
struct TranslationDescription
{
......@@ -74,10 +77,9 @@ class VertexBuffer9 : public VertexBuffer
FormatConverter fallbackConversion;
};
// This table is used to generate mAttributeTypes.
static const TranslationDescription mPossibleTranslations[NUM_GL_VERTEX_ATTRIB_TYPES][2][4]; // [GL types as enumerated by typeIndex()][normalized][size - 1]
static void initializeTranslations(DWORD declTypes);
// This table is used to generate mFormatConverters.
// [GL types as enumerated by typeIndex()][normalized][size - 1]
static const TranslationDescription mPossibleTranslations[NUM_GL_VERTEX_ATTRIB_TYPES][2][4];
static unsigned int typeIndex(GLenum type);
static const FormatConverter &formatConverter(const gl::VertexAttribute &attribute);
......@@ -87,4 +89,4 @@ class VertexBuffer9 : public VertexBuffer
}
#endif // LIBGLESV2_RENDERER_VERTEXBUFFER9_H_
\ No newline at end of file
#endif // LIBGLESV2_RENDERER_VERTEXBUFFER9_H_
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment