Changed D3DConstant table, IndexDataManager,VertexDataManager and vertexconversion namespaces.

TRAC #22198 Signed-off-by: Nicolas Capens Signed-off-by: Daniel Koch git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1548 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 50aadb05
...@@ -61,8 +61,8 @@ void Buffer::bufferData(const void *data, GLsizeiptr size, GLenum usage) ...@@ -61,8 +61,8 @@ void Buffer::bufferData(const void *data, GLsizeiptr size, GLenum usage)
if (usage == GL_STATIC_DRAW) if (usage == GL_STATIC_DRAW)
{ {
mStaticVertexBuffer = new StaticVertexBuffer(mRenderer); mStaticVertexBuffer = new rx::StaticVertexBuffer(mRenderer);
mStaticIndexBuffer = new StaticIndexBuffer(mRenderer); mStaticIndexBuffer = new rx::StaticIndexBuffer(mRenderer);
} }
} }
...@@ -78,12 +78,12 @@ void Buffer::bufferSubData(const void *data, GLsizeiptr size, GLintptr offset) ...@@ -78,12 +78,12 @@ void Buffer::bufferSubData(const void *data, GLsizeiptr size, GLintptr offset)
mUnmodifiedDataUse = 0; mUnmodifiedDataUse = 0;
} }
StaticVertexBuffer *Buffer::getStaticVertexBuffer() rx::StaticVertexBuffer *Buffer::getStaticVertexBuffer()
{ {
return mStaticVertexBuffer; return mStaticVertexBuffer;
} }
StaticIndexBuffer *Buffer::getStaticIndexBuffer() rx::StaticIndexBuffer *Buffer::getStaticIndexBuffer()
{ {
return mStaticIndexBuffer; return mStaticIndexBuffer;
} }
...@@ -108,8 +108,8 @@ void Buffer::promoteStaticUsage(int dataSize) ...@@ -108,8 +108,8 @@ void Buffer::promoteStaticUsage(int dataSize)
if (mUnmodifiedDataUse > 3 * mSize) if (mUnmodifiedDataUse > 3 * mSize)
{ {
mStaticVertexBuffer = new StaticVertexBuffer(mRenderer); mStaticVertexBuffer = new rx::StaticVertexBuffer(mRenderer);
mStaticIndexBuffer = new StaticIndexBuffer(mRenderer); mStaticIndexBuffer = new rx::StaticIndexBuffer(mRenderer);
} }
} }
} }
......
...@@ -21,10 +21,14 @@ ...@@ -21,10 +21,14 @@
#include "common/RefCountObject.h" #include "common/RefCountObject.h"
#include "libGLESv2/renderer/Renderer9.h" #include "libGLESv2/renderer/Renderer9.h"
namespace gl namespace rx
{ {
class StaticVertexBuffer; class StaticVertexBuffer;
class StaticIndexBuffer; class StaticIndexBuffer;
}
namespace gl
{
class Buffer : public RefCountObject class Buffer : public RefCountObject
{ {
...@@ -40,8 +44,8 @@ class Buffer : public RefCountObject ...@@ -40,8 +44,8 @@ class Buffer : public RefCountObject
size_t size() const { return mSize; } size_t size() const { return mSize; }
GLenum usage() const { return mUsage; } GLenum usage() const { return mUsage; }
StaticVertexBuffer *getStaticVertexBuffer(); rx::StaticVertexBuffer *getStaticVertexBuffer();
StaticIndexBuffer *getStaticIndexBuffer(); rx::StaticIndexBuffer *getStaticIndexBuffer();
void invalidateStaticData(); void invalidateStaticData();
void promoteStaticUsage(int dataSize); void promoteStaticUsage(int dataSize);
...@@ -53,8 +57,8 @@ class Buffer : public RefCountObject ...@@ -53,8 +57,8 @@ class Buffer : public RefCountObject
GLsizeiptr mSize; GLsizeiptr mSize;
GLenum mUsage; GLenum mUsage;
StaticVertexBuffer *mStaticVertexBuffer; rx::StaticVertexBuffer *mStaticVertexBuffer;
StaticIndexBuffer *mStaticIndexBuffer; rx::StaticIndexBuffer *mStaticIndexBuffer;
GLsizeiptr mUnmodifiedDataUse; GLsizeiptr mUnmodifiedDataUse;
}; };
......
...@@ -2040,7 +2040,7 @@ void Context::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid ...@@ -2040,7 +2040,7 @@ void Context::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid
applyState(mode); applyState(mode);
TranslatedIndexData indexInfo; rx::TranslatedIndexData indexInfo;
GLenum err = mRenderer->applyIndexBuffer(indices, mState.elementArrayBuffer.get(), count, mode, type, &indexInfo); GLenum err = mRenderer->applyIndexBuffer(indices, mState.elementArrayBuffer.get(), count, mode, type, &indexInfo);
if (err != GL_NO_ERROR) if (err != GL_NO_ERROR)
{ {
......
...@@ -1817,8 +1817,8 @@ bool ProgramBinary::link(InfoLog &infoLog, const AttributeBindings &attributeBin ...@@ -1817,8 +1817,8 @@ bool ProgramBinary::link(InfoLog &infoLog, const AttributeBindings &attributeBin
} }
bool success = true; bool success = true;
D3DConstantTable *constantTableVS = NULL; rx::D3DConstantTable *constantTableVS = NULL;
D3DConstantTable *constantTablePS = NULL; rx::D3DConstantTable *constantTablePS = NULL;
mVertexExecutable = mRenderer->compileToExecutable(infoLog, vertexHLSL.c_str(), GL_VERTEX_SHADER); mVertexExecutable = mRenderer->compileToExecutable(infoLog, vertexHLSL.c_str(), GL_VERTEX_SHADER);
mPixelExecutable = mRenderer->compileToExecutable(infoLog, pixelHLSL.c_str(), GL_FRAGMENT_SHADER); mPixelExecutable = mRenderer->compileToExecutable(infoLog, pixelHLSL.c_str(), GL_FRAGMENT_SHADER);
...@@ -1937,11 +1937,11 @@ bool ProgramBinary::linkAttributes(InfoLog &infoLog, const AttributeBindings &at ...@@ -1937,11 +1937,11 @@ bool ProgramBinary::linkAttributes(InfoLog &infoLog, const AttributeBindings &at
return true; return true;
} }
bool ProgramBinary::linkUniforms(InfoLog &infoLog, D3DConstantTable *vsConstantTable, D3DConstantTable *psConstantTable) bool ProgramBinary::linkUniforms(InfoLog &infoLog, rx::D3DConstantTable *vsConstantTable, rx::D3DConstantTable *psConstantTable)
{ {
for (unsigned int constantIndex = 0; constantIndex < psConstantTable->constants(); constantIndex++) for (unsigned int constantIndex = 0; constantIndex < psConstantTable->constants(); constantIndex++)
{ {
const D3DConstant *constant = psConstantTable->getConstant(constantIndex); const rx::D3DConstant *constant = psConstantTable->getConstant(constantIndex);
if (!defineUniform(infoLog, GL_FRAGMENT_SHADER, constant, "", vsConstantTable, psConstantTable)) if (!defineUniform(infoLog, GL_FRAGMENT_SHADER, constant, "", vsConstantTable, psConstantTable))
{ {
...@@ -1951,7 +1951,7 @@ bool ProgramBinary::linkUniforms(InfoLog &infoLog, D3DConstantTable *vsConstantT ...@@ -1951,7 +1951,7 @@ bool ProgramBinary::linkUniforms(InfoLog &infoLog, D3DConstantTable *vsConstantT
for (unsigned int constantIndex = 0; constantIndex < vsConstantTable->constants(); constantIndex++) for (unsigned int constantIndex = 0; constantIndex < vsConstantTable->constants(); constantIndex++)
{ {
const D3DConstant *constant = vsConstantTable->getConstant(constantIndex); const rx::D3DConstant *constant = vsConstantTable->getConstant(constantIndex);
if (!defineUniform(infoLog, GL_VERTEX_SHADER, constant, "", vsConstantTable, psConstantTable)) if (!defineUniform(infoLog, GL_VERTEX_SHADER, constant, "", vsConstantTable, psConstantTable))
{ {
...@@ -1963,15 +1963,15 @@ bool ProgramBinary::linkUniforms(InfoLog &infoLog, D3DConstantTable *vsConstantT ...@@ -1963,15 +1963,15 @@ bool ProgramBinary::linkUniforms(InfoLog &infoLog, D3DConstantTable *vsConstantT
// Adds the description of a constant found in the binary shader to the list of uniforms // Adds the description of a constant found in the binary shader to the list of uniforms
// Returns true if succesful (uniform not already defined) // Returns true if succesful (uniform not already defined)
bool ProgramBinary::defineUniform(InfoLog &infoLog, GLenum shader, const D3DConstant *constant, const std::string &name, bool ProgramBinary::defineUniform(InfoLog &infoLog, GLenum shader, const rx::D3DConstant *constant, const std::string &name,
D3DConstantTable *vsConstantTable, D3DConstantTable *psConstantTable) rx::D3DConstantTable *vsConstantTable, rx::D3DConstantTable *psConstantTable)
{ {
if (constant->registerSet == D3DConstant::RS_SAMPLER) if (constant->registerSet == rx::D3DConstant::RS_SAMPLER)
{ {
for (unsigned int i = 0; i < constant->registerCount; i++) for (unsigned int i = 0; i < constant->registerCount; i++)
{ {
const D3DConstant *psConstant = psConstantTable->getConstantByName(constant->name.c_str()); const rx::D3DConstant *psConstant = psConstantTable->getConstantByName(constant->name.c_str());
const D3DConstant *vsConstant = vsConstantTable->getConstantByName(constant->name.c_str()); const rx::D3DConstant *vsConstant = vsConstantTable->getConstantByName(constant->name.c_str());
if (psConstant) if (psConstant)
{ {
...@@ -1980,7 +1980,7 @@ bool ProgramBinary::defineUniform(InfoLog &infoLog, GLenum shader, const D3DCons ...@@ -1980,7 +1980,7 @@ bool ProgramBinary::defineUniform(InfoLog &infoLog, GLenum shader, const D3DCons
if (samplerIndex < MAX_TEXTURE_IMAGE_UNITS) if (samplerIndex < MAX_TEXTURE_IMAGE_UNITS)
{ {
mSamplersPS[samplerIndex].active = true; mSamplersPS[samplerIndex].active = true;
mSamplersPS[samplerIndex].textureType = (constant->type == D3DConstant::PT_SAMPLERCUBE) ? TEXTURE_CUBE : TEXTURE_2D; mSamplersPS[samplerIndex].textureType = (constant->type == rx::D3DConstant::PT_SAMPLERCUBE) ? TEXTURE_CUBE : TEXTURE_2D;
mSamplersPS[samplerIndex].logicalTextureUnit = 0; mSamplersPS[samplerIndex].logicalTextureUnit = 0;
mUsedPixelSamplerRange = std::max(samplerIndex + 1, mUsedPixelSamplerRange); mUsedPixelSamplerRange = std::max(samplerIndex + 1, mUsedPixelSamplerRange);
} }
...@@ -1998,7 +1998,7 @@ bool ProgramBinary::defineUniform(InfoLog &infoLog, GLenum shader, const D3DCons ...@@ -1998,7 +1998,7 @@ bool ProgramBinary::defineUniform(InfoLog &infoLog, GLenum shader, const D3DCons
if (samplerIndex < getContext()->getMaximumVertexTextureImageUnits()) if (samplerIndex < getContext()->getMaximumVertexTextureImageUnits())
{ {
mSamplersVS[samplerIndex].active = true; mSamplersVS[samplerIndex].active = true;
mSamplersVS[samplerIndex].textureType = (constant->type == D3DConstant::PT_SAMPLERCUBE) ? TEXTURE_CUBE : TEXTURE_2D; mSamplersVS[samplerIndex].textureType = (constant->type == rx::D3DConstant::PT_SAMPLERCUBE) ? TEXTURE_CUBE : TEXTURE_2D;
mSamplersVS[samplerIndex].logicalTextureUnit = 0; mSamplersVS[samplerIndex].logicalTextureUnit = 0;
mUsedVertexSamplerRange = std::max(samplerIndex + 1, mUsedVertexSamplerRange); mUsedVertexSamplerRange = std::max(samplerIndex + 1, mUsedVertexSamplerRange);
} }
...@@ -2013,13 +2013,13 @@ bool ProgramBinary::defineUniform(InfoLog &infoLog, GLenum shader, const D3DCons ...@@ -2013,13 +2013,13 @@ bool ProgramBinary::defineUniform(InfoLog &infoLog, GLenum shader, const D3DCons
switch(constant->typeClass) switch(constant->typeClass)
{ {
case D3DConstant::CLASS_STRUCT: case rx::D3DConstant::CLASS_STRUCT:
{ {
for (unsigned int arrayIndex = 0; arrayIndex < constant->elements; arrayIndex++) for (unsigned int arrayIndex = 0; arrayIndex < constant->elements; arrayIndex++)
{ {
for (unsigned int field = 0; field < constant->structMembers[arrayIndex].size(); field++) for (unsigned int field = 0; field < constant->structMembers[arrayIndex].size(); field++)
{ {
const D3DConstant *fieldConstant = constant->structMembers[arrayIndex][field]; const rx::D3DConstant *fieldConstant = constant->structMembers[arrayIndex][field];
std::string structIndex = (constant->elements > 1) ? ("[" + str(arrayIndex) + "]") : ""; std::string structIndex = (constant->elements > 1) ? ("[" + str(arrayIndex) + "]") : "";
...@@ -2032,10 +2032,10 @@ bool ProgramBinary::defineUniform(InfoLog &infoLog, GLenum shader, const D3DCons ...@@ -2032,10 +2032,10 @@ bool ProgramBinary::defineUniform(InfoLog &infoLog, GLenum shader, const D3DCons
return true; return true;
} }
case D3DConstant::CLASS_SCALAR: case rx::D3DConstant::CLASS_SCALAR:
case D3DConstant::CLASS_VECTOR: case rx::D3DConstant::CLASS_VECTOR:
case D3DConstant::CLASS_MATRIX_COLUMNS: case rx::D3DConstant::CLASS_MATRIX_COLUMNS:
case D3DConstant::CLASS_OBJECT: case rx::D3DConstant::CLASS_OBJECT:
return defineUniform(shader, constant, name + constant->name); return defineUniform(shader, constant, name + constant->name);
default: default:
UNREACHABLE(); UNREACHABLE();
...@@ -2043,7 +2043,7 @@ bool ProgramBinary::defineUniform(InfoLog &infoLog, GLenum shader, const D3DCons ...@@ -2043,7 +2043,7 @@ bool ProgramBinary::defineUniform(InfoLog &infoLog, GLenum shader, const D3DCons
} }
} }
bool ProgramBinary::defineUniform(GLenum shader, const D3DConstant *constant, const std::string &_name) bool ProgramBinary::defineUniform(GLenum shader, const rx::D3DConstant *constant, const std::string &_name)
{ {
Uniform *uniform = createUniform(constant, _name); Uniform *uniform = createUniform(constant, _name);
...@@ -2081,27 +2081,27 @@ bool ProgramBinary::defineUniform(GLenum shader, const D3DConstant *constant, co ...@@ -2081,27 +2081,27 @@ bool ProgramBinary::defineUniform(GLenum shader, const D3DConstant *constant, co
return true; return true;
} }
Uniform *ProgramBinary::createUniform(const D3DConstant *constant, const std::string &_name) Uniform *ProgramBinary::createUniform(const rx::D3DConstant *constant, const std::string &_name)
{ {
if (constant->rows == 1) // Vectors and scalars if (constant->rows == 1) // Vectors and scalars
{ {
switch (constant->type) switch (constant->type)
{ {
case D3DConstant::PT_SAMPLER2D: case rx::D3DConstant::PT_SAMPLER2D:
switch (constant->columns) switch (constant->columns)
{ {
case 1: return new Uniform(GL_SAMPLER_2D, _name, constant->elements); case 1: return new Uniform(GL_SAMPLER_2D, _name, constant->elements);
default: UNREACHABLE(); default: UNREACHABLE();
} }
break; break;
case D3DConstant::PT_SAMPLERCUBE: case rx::D3DConstant::PT_SAMPLERCUBE:
switch (constant->columns) switch (constant->columns)
{ {
case 1: return new Uniform(GL_SAMPLER_CUBE, _name, constant->elements); case 1: return new Uniform(GL_SAMPLER_CUBE, _name, constant->elements);
default: UNREACHABLE(); default: UNREACHABLE();
} }
break; break;
case D3DConstant::PT_BOOL: case rx::D3DConstant::PT_BOOL:
switch (constant->columns) switch (constant->columns)
{ {
case 1: return new Uniform(GL_BOOL, _name, constant->elements); case 1: return new Uniform(GL_BOOL, _name, constant->elements);
...@@ -2111,7 +2111,7 @@ Uniform *ProgramBinary::createUniform(const D3DConstant *constant, const std::st ...@@ -2111,7 +2111,7 @@ Uniform *ProgramBinary::createUniform(const D3DConstant *constant, const std::st
default: UNREACHABLE(); default: UNREACHABLE();
} }
break; break;
case D3DConstant::PT_INT: case rx::D3DConstant::PT_INT:
switch (constant->columns) switch (constant->columns)
{ {
case 1: return new Uniform(GL_INT, _name, constant->elements); case 1: return new Uniform(GL_INT, _name, constant->elements);
...@@ -2121,7 +2121,7 @@ Uniform *ProgramBinary::createUniform(const D3DConstant *constant, const std::st ...@@ -2121,7 +2121,7 @@ Uniform *ProgramBinary::createUniform(const D3DConstant *constant, const std::st
default: UNREACHABLE(); default: UNREACHABLE();
} }
break; break;
case D3DConstant::PT_FLOAT: case rx::D3DConstant::PT_FLOAT:
switch (constant->columns) switch (constant->columns)
{ {
case 1: return new Uniform(GL_FLOAT, _name, constant->elements); case 1: return new Uniform(GL_FLOAT, _name, constant->elements);
...@@ -2139,7 +2139,7 @@ Uniform *ProgramBinary::createUniform(const D3DConstant *constant, const std::st ...@@ -2139,7 +2139,7 @@ Uniform *ProgramBinary::createUniform(const D3DConstant *constant, const std::st
{ {
switch (constant->type) switch (constant->type)
{ {
case D3DConstant::PT_FLOAT: case rx::D3DConstant::PT_FLOAT:
switch (constant->rows) switch (constant->rows)
{ {
case 2: return new Uniform(GL_FLOAT_MAT2, _name, constant->elements); case 2: return new Uniform(GL_FLOAT_MAT2, _name, constant->elements);
......
...@@ -56,13 +56,13 @@ struct Uniform ...@@ -56,13 +56,13 @@ struct Uniform
registerCount = 0; registerCount = 0;
} }
void set(const D3DConstant *constant) void set(const rx::D3DConstant *constant)
{ {
switch(constant->registerSet) switch(constant->registerSet)
{ {
case D3DConstant::RS_BOOL: boolIndex = constant->registerIndex; break; case rx::D3DConstant::RS_BOOL: boolIndex = constant->registerIndex; break;
case D3DConstant::RS_FLOAT4: float4Index = constant->registerIndex; break; case rx::D3DConstant::RS_FLOAT4: float4Index = constant->registerIndex; break;
case D3DConstant::RS_SAMPLER: samplerIndex = constant->registerIndex; break; case rx::D3DConstant::RS_SAMPLER: samplerIndex = constant->registerIndex; break;
default: UNREACHABLE(); default: UNREACHABLE();
} }
...@@ -171,11 +171,11 @@ class ProgramBinary : public RefCountObject ...@@ -171,11 +171,11 @@ class ProgramBinary : public RefCountObject
bool linkAttributes(InfoLog &infoLog, const AttributeBindings &attributeBindings, FragmentShader *fragmentShader, VertexShader *vertexShader); bool linkAttributes(InfoLog &infoLog, const AttributeBindings &attributeBindings, FragmentShader *fragmentShader, VertexShader *vertexShader);
bool linkUniforms(InfoLog &infoLog, D3DConstantTable *vsConstantTable, D3DConstantTable *psConstantTable); bool linkUniforms(InfoLog &infoLog, rx::D3DConstantTable *vsConstantTable, rx::D3DConstantTable *psConstantTable);
bool defineUniform(InfoLog &infoLog, GLenum shader, const D3DConstant *constant, const std::string &name, bool defineUniform(InfoLog &infoLog, GLenum shader, const rx::D3DConstant *constant, const std::string &name,
D3DConstantTable *vsConstantTable, D3DConstantTable *psConstantTable); rx::D3DConstantTable *vsConstantTable, rx::D3DConstantTable *psConstantTable);
bool defineUniform(GLenum shader, const D3DConstant *constant, const std::string &name); bool defineUniform(GLenum shader, const rx::D3DConstant *constant, const std::string &name);
Uniform *createUniform( const D3DConstant *constant, const std::string &name); Uniform *createUniform(const rx::D3DConstant *constant, const std::string &name);
bool applyUniformnfv(IDirect3DDevice9 *device, Uniform *targetUniform, const GLfloat *v); // D3D9_REPLACE bool applyUniformnfv(IDirect3DDevice9 *device, Uniform *targetUniform, const GLfloat *v); // D3D9_REPLACE
bool applyUniform1iv(IDirect3DDevice9 *device, Uniform *targetUniform, GLsizei count, const GLint *v); bool applyUniform1iv(IDirect3DDevice9 *device, Uniform *targetUniform, GLsizei count, const GLint *v);
bool applyUniform2iv(IDirect3DDevice9 *device, Uniform *targetUniform, GLsizei count, const GLint *v); bool applyUniform2iv(IDirect3DDevice9 *device, Uniform *targetUniform, GLsizei count, const GLint *v);
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
const static int SHADER_VERSION_MASK = D3DVS_VERSION(0, 0); const static int SHADER_VERSION_MASK = D3DVS_VERSION(0, 0);
const static int FOURCC_CTAB = MAKEFOURCC('C','T','A','B'); const static int FOURCC_CTAB = MAKEFOURCC('C','T','A','B');
namespace gl namespace rx
{ {
// These structs and constants correspond to the format of the constant table in a shader binary. // These structs and constants correspond to the format of the constant table in a shader binary.
// They match the corresponding structures in d3dx9shader.h. // They match the corresponding structures in d3dx9shader.h.
...@@ -147,7 +147,7 @@ unsigned D3DConstant::addStructMembers(const char *base, RegisterSet registerSet ...@@ -147,7 +147,7 @@ unsigned D3DConstant::addStructMembers(const char *base, RegisterSet registerSet
D3DConstantTable::D3DConstantTable(void *blob, size_t size) : mError(false) D3DConstantTable::D3DConstantTable(void *blob, size_t size) : mError(false)
{ {
BinaryInputStream stream(blob, size); gl::BinaryInputStream stream(blob, size);
int version; int version;
stream.read(&version); stream.read(&version);
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include "common/angleutils.h" #include "common/angleutils.h"
namespace gl namespace rx
{ {
namespace ctab namespace ctab
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include "libGLESv2/mathutil.h" #include "libGLESv2/mathutil.h"
#include "libGLESv2/main.h" #include "libGLESv2/main.h"
namespace gl namespace rx
{ {
unsigned int IndexBuffer::mCurrentSerial = 1; unsigned int IndexBuffer::mCurrentSerial = 1;
...@@ -107,7 +107,7 @@ void computeRange(GLenum type, const GLvoid *indices, GLsizei count, GLuint *min ...@@ -107,7 +107,7 @@ void computeRange(GLenum type, const GLvoid *indices, GLsizei count, GLuint *min
else UNREACHABLE(); else UNREACHABLE();
} }
GLenum IndexDataManager::prepareIndexData(GLenum type, GLsizei count, Buffer *buffer, const GLvoid *indices, TranslatedIndexData *translated, IDirect3DIndexBuffer9 **d3dIndexBuffer, unsigned int *serial) GLenum IndexDataManager::prepareIndexData(GLenum type, GLsizei count, gl::Buffer *buffer, const GLvoid *indices, TranslatedIndexData *translated, IDirect3DIndexBuffer9 **d3dIndexBuffer, unsigned int *serial)
{ {
if (!mStreamingBufferShort) if (!mStreamingBufferShort)
{ {
......
...@@ -23,7 +23,7 @@ namespace ...@@ -23,7 +23,7 @@ namespace
enum { INITIAL_INDEX_BUFFER_SIZE = 4096 * sizeof(GLuint) }; enum { INITIAL_INDEX_BUFFER_SIZE = 4096 * sizeof(GLuint) };
} }
namespace gl namespace rx
{ {
struct TranslatedIndexData struct TranslatedIndexData
...@@ -125,7 +125,7 @@ class IndexDataManager ...@@ -125,7 +125,7 @@ class IndexDataManager
IndexDataManager(rx::Renderer9 *renderer); IndexDataManager(rx::Renderer9 *renderer);
virtual ~IndexDataManager(); virtual ~IndexDataManager();
GLenum prepareIndexData(GLenum type, GLsizei count, Buffer *arrayElementBuffer, const GLvoid *indices, TranslatedIndexData *translated, IDirect3DIndexBuffer9 **indexBuffer, unsigned int *serial); GLenum prepareIndexData(GLenum type, GLsizei count, gl::Buffer *arrayElementBuffer, const GLvoid *indices, TranslatedIndexData *translated, IDirect3DIndexBuffer9 **indexBuffer, unsigned int *serial);
StaticIndexBuffer *getCountingIndices(GLsizei count); StaticIndexBuffer *getCountingIndices(GLsizei count);
private: private:
......
...@@ -47,7 +47,6 @@ class InfoLog; ...@@ -47,7 +47,6 @@ class InfoLog;
class ProgramBinary; class ProgramBinary;
class VertexAttribute; class VertexAttribute;
class Buffer; class Buffer;
struct TranslatedIndexData;
} }
namespace rx namespace rx
...@@ -55,6 +54,7 @@ namespace rx ...@@ -55,6 +54,7 @@ namespace rx
class TextureStorage2D; class TextureStorage2D;
class TextureStorageCubeMap; class TextureStorageCubeMap;
class Blit; class Blit;
struct TranslatedIndexData;
struct ConfigDesc struct ConfigDesc
{ {
...@@ -97,10 +97,10 @@ class Renderer ...@@ -97,10 +97,10 @@ class Renderer
virtual void applyShaders(gl::ProgramBinary *programBinary) = 0; virtual void applyShaders(gl::ProgramBinary *programBinary) = 0;
virtual bool applyPrimitiveType(GLenum primitiveType, GLsizei elementCount) = 0; virtual bool applyPrimitiveType(GLenum primitiveType, GLsizei elementCount) = 0;
virtual GLenum applyVertexBuffer(gl::ProgramBinary *programBinary, gl::VertexAttribute vertexAttributes[], GLint first, GLsizei count, GLsizei instances) = 0; virtual GLenum applyVertexBuffer(gl::ProgramBinary *programBinary, gl::VertexAttribute vertexAttributes[], GLint first, GLsizei count, GLsizei instances) = 0;
virtual GLenum applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, gl::TranslatedIndexData *indexInfo) = 0; virtual GLenum applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo) = 0;
virtual void drawArrays(GLenum mode, GLsizei count, GLsizei instances) = 0; virtual void drawArrays(GLenum mode, GLsizei count, GLsizei instances) = 0;
virtual void drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer, const gl::TranslatedIndexData &indexInfo) = 0; virtual void drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer, const TranslatedIndexData &indexInfo) = 0;
virtual void clear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer) = 0; virtual void clear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer) = 0;
......
...@@ -664,7 +664,7 @@ GLenum Renderer11::applyVertexBuffer(gl::ProgramBinary *programBinary, gl::Verte ...@@ -664,7 +664,7 @@ GLenum Renderer11::applyVertexBuffer(gl::ProgramBinary *programBinary, gl::Verte
return GL_NO_ERROR; return GL_NO_ERROR;
} }
GLenum Renderer11::applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, gl::TranslatedIndexData *indexInfo) GLenum Renderer11::applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo)
{ {
// TODO // TODO
UNIMPLEMENTED(); UNIMPLEMENTED();
...@@ -677,7 +677,7 @@ void Renderer11::drawArrays(GLenum mode, GLsizei count, GLsizei instances) ...@@ -677,7 +677,7 @@ void Renderer11::drawArrays(GLenum mode, GLsizei count, GLsizei instances)
mDeviceContext->Draw(count, 0); mDeviceContext->Draw(count, 0);
} }
void Renderer11::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer, const gl::TranslatedIndexData &indexInfo) void Renderer11::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer, const TranslatedIndexData &indexInfo)
{ {
// TODO // TODO
UNIMPLEMENTED(); UNIMPLEMENTED();
......
...@@ -63,10 +63,10 @@ class Renderer11 : public Renderer ...@@ -63,10 +63,10 @@ class Renderer11 : public Renderer
virtual bool applyRenderTarget(gl::Framebuffer *frameBuffer); virtual bool applyRenderTarget(gl::Framebuffer *frameBuffer);
virtual void applyShaders(gl::ProgramBinary *programBinary); virtual void applyShaders(gl::ProgramBinary *programBinary);
virtual GLenum applyVertexBuffer(gl::ProgramBinary *programBinary, gl::VertexAttribute vertexAttributes[], GLint first, GLsizei count, GLsizei instances); virtual GLenum applyVertexBuffer(gl::ProgramBinary *programBinary, gl::VertexAttribute vertexAttributes[], GLint first, GLsizei count, GLsizei instances);
virtual GLenum applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, gl::TranslatedIndexData *indexInfo); virtual GLenum applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo);
virtual void drawArrays(GLenum mode, GLsizei count, GLsizei instances); virtual void drawArrays(GLenum mode, GLsizei count, GLsizei instances);
virtual void drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer, const gl::TranslatedIndexData &indexInfo); virtual void drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer, const TranslatedIndexData &indexInfo);
virtual void clear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer); virtual void clear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer);
......
...@@ -379,8 +379,8 @@ void Renderer9::initializeDevice() ...@@ -379,8 +379,8 @@ void Renderer9::initializeDevice()
ASSERT(!mBlit && !mVertexDataManager && !mIndexDataManager); ASSERT(!mBlit && !mVertexDataManager && !mIndexDataManager);
mBlit = new Blit(this); mBlit = new Blit(this);
mVertexDataManager = new gl::VertexDataManager(this); mVertexDataManager = new rx::VertexDataManager(this);
mIndexDataManager = new gl::IndexDataManager(this); mIndexDataManager = new rx::IndexDataManager(this);
} }
D3DPRESENT_PARAMETERS Renderer9::getDefaultPresentParameters() D3DPRESENT_PARAMETERS Renderer9::getDefaultPresentParameters()
...@@ -1124,7 +1124,7 @@ bool Renderer9::applyRenderTarget(gl::Framebuffer *framebuffer) ...@@ -1124,7 +1124,7 @@ bool Renderer9::applyRenderTarget(gl::Framebuffer *framebuffer)
GLenum Renderer9::applyVertexBuffer(gl::ProgramBinary *programBinary, gl::VertexAttribute vertexAttributes[], GLint first, GLsizei count, GLsizei instances) GLenum Renderer9::applyVertexBuffer(gl::ProgramBinary *programBinary, gl::VertexAttribute vertexAttributes[], GLint first, GLsizei count, GLsizei instances)
{ {
gl::TranslatedAttribute attributes[gl::MAX_VERTEX_ATTRIBS]; TranslatedAttribute attributes[gl::MAX_VERTEX_ATTRIBS];
GLenum err = mVertexDataManager->prepareVertexData(vertexAttributes, programBinary, first, count, attributes, instances); GLenum err = mVertexDataManager->prepareVertexData(vertexAttributes, programBinary, first, count, attributes, instances);
if (err != GL_NO_ERROR) if (err != GL_NO_ERROR)
{ {
...@@ -1135,7 +1135,7 @@ GLenum Renderer9::applyVertexBuffer(gl::ProgramBinary *programBinary, gl::Vertex ...@@ -1135,7 +1135,7 @@ GLenum Renderer9::applyVertexBuffer(gl::ProgramBinary *programBinary, gl::Vertex
} }
// Applies the indices and element array bindings to the Direct3D 9 device // Applies the indices and element array bindings to the Direct3D 9 device
GLenum Renderer9::applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, gl::TranslatedIndexData *indexInfo) GLenum Renderer9::applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo)
{ {
IDirect3DIndexBuffer9 *indexBuffer; IDirect3DIndexBuffer9 *indexBuffer;
unsigned int serial; unsigned int serial;
...@@ -1163,7 +1163,7 @@ void Renderer9::drawArrays(GLenum mode, GLsizei count, GLsizei instances) ...@@ -1163,7 +1163,7 @@ void Renderer9::drawArrays(GLenum mode, GLsizei count, GLsizei instances)
} }
else if (instances > 0) else if (instances > 0)
{ {
gl::StaticIndexBuffer *countingIB = mIndexDataManager->getCountingIndices(count); StaticIndexBuffer *countingIB = mIndexDataManager->getCountingIndices(count);
if (countingIB) if (countingIB)
{ {
if (mAppliedIBSerial != countingIB->getSerial()) if (mAppliedIBSerial != countingIB->getSerial())
...@@ -1189,7 +1189,7 @@ void Renderer9::drawArrays(GLenum mode, GLsizei count, GLsizei instances) ...@@ -1189,7 +1189,7 @@ void Renderer9::drawArrays(GLenum mode, GLsizei count, GLsizei instances)
} }
} }
void Renderer9::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer, const gl::TranslatedIndexData &indexInfo) void Renderer9::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer, const TranslatedIndexData &indexInfo)
{ {
startScene(); startScene();
...@@ -1226,7 +1226,7 @@ void Renderer9::drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices, ...@@ -1226,7 +1226,7 @@ void Renderer9::drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices,
if (!mLineLoopIB) if (!mLineLoopIB)
{ {
mLineLoopIB = new gl::StreamingIndexBuffer(this, INITIAL_INDEX_BUFFER_SIZE, D3DFMT_INDEX32); mLineLoopIB = new StreamingIndexBuffer(this, INITIAL_INDEX_BUFFER_SIZE, D3DFMT_INDEX32);
} }
if (mLineLoopIB) if (mLineLoopIB)
...@@ -1283,7 +1283,7 @@ void Renderer9::drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices, ...@@ -1283,7 +1283,7 @@ void Renderer9::drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices,
if (!mLineLoopIB) if (!mLineLoopIB)
{ {
mLineLoopIB = new gl::StreamingIndexBuffer(this, INITIAL_INDEX_BUFFER_SIZE, D3DFMT_INDEX16); mLineLoopIB = new StreamingIndexBuffer(this, INITIAL_INDEX_BUFFER_SIZE, D3DFMT_INDEX16);
} }
if (mLineLoopIB) if (mLineLoopIB)
...@@ -2618,7 +2618,7 @@ RenderTarget *Renderer9::createRenderTarget(int width, int height, GLenum format ...@@ -2618,7 +2618,7 @@ RenderTarget *Renderer9::createRenderTarget(int width, int height, GLenum format
ShaderExecutable *Renderer9::loadExecutable(const void *function, size_t length, GLenum type, void *data) ShaderExecutable *Renderer9::loadExecutable(const void *function, size_t length, GLenum type, void *data)
{ {
ShaderExecutable9 *executable = NULL; ShaderExecutable9 *executable = NULL;
gl::D3DConstantTable *table = reinterpret_cast<gl::D3DConstantTable *>(data); D3DConstantTable *table = reinterpret_cast<D3DConstantTable *>(data);
switch (type) switch (type)
{ {
...@@ -2669,7 +2669,7 @@ ShaderExecutable *Renderer9::compileToExecutable(gl::InfoLog &infoLog, const cha ...@@ -2669,7 +2669,7 @@ ShaderExecutable *Renderer9::compileToExecutable(gl::InfoLog &infoLog, const cha
if (!binary) if (!binary)
return NULL; return NULL;
gl::D3DConstantTable *constantTable = new gl::D3DConstantTable(binary->GetBufferPointer(), binary->GetBufferSize()); D3DConstantTable *constantTable = new D3DConstantTable(binary->GetBufferPointer(), binary->GetBufferSize());
if (constantTable->error()) if (constantTable->error())
{ {
delete constantTable; delete constantTable;
......
...@@ -28,16 +28,12 @@ ...@@ -28,16 +28,12 @@
#include "libGLESv2/renderer/Renderer.h" #include "libGLESv2/renderer/Renderer.h"
#include "libGLESv2/renderer/IndexDataManager.h" #include "libGLESv2/renderer/IndexDataManager.h"
namespace gl namespace rx
{ {
class D3DConstantTable; class D3DConstantTable;
class VertexDataManager; class VertexDataManager;
class StreamingIndexBuffer; class StreamingIndexBuffer;
struct TranslatedAttribute; struct TranslatedAttribute;
}
namespace rx
{
class Renderer9 : public Renderer class Renderer9 : public Renderer
{ {
...@@ -96,10 +92,10 @@ class Renderer9 : public Renderer ...@@ -96,10 +92,10 @@ class Renderer9 : public Renderer
virtual void applyShaders(gl::ProgramBinary *programBinary); virtual void applyShaders(gl::ProgramBinary *programBinary);
virtual bool applyPrimitiveType(GLenum primitiveType, GLsizei elementCount); virtual bool applyPrimitiveType(GLenum primitiveType, GLsizei elementCount);
virtual GLenum applyVertexBuffer(gl::ProgramBinary *programBinary, gl::VertexAttribute vertexAttributes[], GLint first, GLsizei count, GLsizei instances); virtual GLenum applyVertexBuffer(gl::ProgramBinary *programBinary, gl::VertexAttribute vertexAttributes[], GLint first, GLsizei count, GLsizei instances);
virtual GLenum applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, gl::TranslatedIndexData *indexInfo); virtual GLenum applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo);
virtual void drawArrays(GLenum mode, GLsizei count, GLsizei instances); virtual void drawArrays(GLenum mode, GLsizei count, GLsizei instances);
virtual void drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer, const gl::TranslatedIndexData &indexInfo); virtual void drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer, const TranslatedIndexData &indexInfo);
virtual void clear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer); virtual void clear(const gl::ClearParameters &clearParams, gl::Framebuffer *frameBuffer);
...@@ -265,11 +261,11 @@ class Renderer9 : public Renderer ...@@ -265,11 +261,11 @@ class Renderer9 : public Renderer
VertexShaderCache mVertexShaderCache; VertexShaderCache mVertexShaderCache;
PixelShaderCache mPixelShaderCache; PixelShaderCache mPixelShaderCache;
gl::VertexDataManager *mVertexDataManager; VertexDataManager *mVertexDataManager;
VertexDeclarationCache mVertexDeclarationCache; VertexDeclarationCache mVertexDeclarationCache;
gl::IndexDataManager *mIndexDataManager; IndexDataManager *mIndexDataManager;
gl::StreamingIndexBuffer *mLineLoopIB; StreamingIndexBuffer *mLineLoopIB;
}; };
} }
......
...@@ -40,7 +40,7 @@ class ShaderExecutable ...@@ -40,7 +40,7 @@ class ShaderExecutable
return mLength; return mLength;
} }
virtual gl::D3DConstantTable *getConstantTable() = 0; // D3D9_REMOVE virtual D3DConstantTable *getConstantTable() = 0; // D3D9_REMOVE
private: private:
DISALLOW_COPY_AND_ASSIGN(ShaderExecutable); DISALLOW_COPY_AND_ASSIGN(ShaderExecutable);
......
...@@ -56,7 +56,7 @@ ID3D11PixelShader *ShaderExecutable11::getPixelShader() ...@@ -56,7 +56,7 @@ ID3D11PixelShader *ShaderExecutable11::getPixelShader()
return mPixelExecutable; return mPixelExecutable;
} }
gl::D3DConstantTable *ShaderExecutable11::getConstantTable() D3DConstantTable *ShaderExecutable11::getConstantTable()
{ {
return NULL; return NULL;
} }
......
...@@ -29,7 +29,7 @@ class ShaderExecutable11 : public ShaderExecutable ...@@ -29,7 +29,7 @@ class ShaderExecutable11 : public ShaderExecutable
ID3D11PixelShader *getPixelShader(); ID3D11PixelShader *getPixelShader();
ID3D11VertexShader *getVertexShader(); ID3D11VertexShader *getVertexShader();
virtual gl::D3DConstantTable *getConstantTable(); virtual D3DConstantTable *getConstantTable();
private: private:
DISALLOW_COPY_AND_ASSIGN(ShaderExecutable11); DISALLOW_COPY_AND_ASSIGN(ShaderExecutable11);
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
namespace rx namespace rx
{ {
ShaderExecutable9::ShaderExecutable9(const void *function, size_t length, IDirect3DPixelShader9 *executable, gl::D3DConstantTable *constantTable) ShaderExecutable9::ShaderExecutable9(const void *function, size_t length, IDirect3DPixelShader9 *executable, D3DConstantTable *constantTable)
: ShaderExecutable(function, length) : ShaderExecutable(function, length)
{ {
mPixelExecutable = executable; mPixelExecutable = executable;
...@@ -22,7 +22,7 @@ ShaderExecutable9::ShaderExecutable9(const void *function, size_t length, IDirec ...@@ -22,7 +22,7 @@ ShaderExecutable9::ShaderExecutable9(const void *function, size_t length, IDirec
mConstantTable = constantTable; mConstantTable = constantTable;
} }
ShaderExecutable9::ShaderExecutable9(const void *function, size_t length, IDirect3DVertexShader9 *executable, gl::D3DConstantTable *constantTable) ShaderExecutable9::ShaderExecutable9(const void *function, size_t length, IDirect3DVertexShader9 *executable, D3DConstantTable *constantTable)
: ShaderExecutable(function, length) : ShaderExecutable(function, length)
{ {
mVertexExecutable = executable; mVertexExecutable = executable;
...@@ -60,7 +60,7 @@ IDirect3DPixelShader9 *ShaderExecutable9::getPixelShader() ...@@ -60,7 +60,7 @@ IDirect3DPixelShader9 *ShaderExecutable9::getPixelShader()
return mPixelExecutable; return mPixelExecutable;
} }
gl::D3DConstantTable *ShaderExecutable9::getConstantTable() D3DConstantTable *ShaderExecutable9::getConstantTable()
{ {
return mConstantTable; return mConstantTable;
} }
......
...@@ -21,15 +21,15 @@ namespace rx ...@@ -21,15 +21,15 @@ namespace rx
class ShaderExecutable9 : public ShaderExecutable class ShaderExecutable9 : public ShaderExecutable
{ {
public: public:
ShaderExecutable9(const void *function, size_t length, IDirect3DPixelShader9 *executable, gl::D3DConstantTable *constantTable); ShaderExecutable9(const void *function, size_t length, IDirect3DPixelShader9 *executable, D3DConstantTable *constantTable);
ShaderExecutable9(const void *function, size_t length, IDirect3DVertexShader9 *executable, gl::D3DConstantTable *constantTable); ShaderExecutable9(const void *function, size_t length, IDirect3DVertexShader9 *executable, D3DConstantTable *constantTable);
virtual ~ShaderExecutable9(); virtual ~ShaderExecutable9();
static ShaderExecutable9 *makeShaderExecutable9(ShaderExecutable *executable); static ShaderExecutable9 *makeShaderExecutable9(ShaderExecutable *executable);
IDirect3DPixelShader9 *getPixelShader(); IDirect3DPixelShader9 *getPixelShader();
IDirect3DVertexShader9 *getVertexShader(); IDirect3DVertexShader9 *getVertexShader();
virtual gl::D3DConstantTable *getConstantTable(); virtual D3DConstantTable *getConstantTable();
private: private:
DISALLOW_COPY_AND_ASSIGN(ShaderExecutable9); DISALLOW_COPY_AND_ASSIGN(ShaderExecutable9);
...@@ -37,7 +37,7 @@ class ShaderExecutable9 : public ShaderExecutable ...@@ -37,7 +37,7 @@ class ShaderExecutable9 : public ShaderExecutable
IDirect3DPixelShader9 *mPixelExecutable; IDirect3DPixelShader9 *mPixelExecutable;
IDirect3DVertexShader9 *mVertexExecutable; IDirect3DVertexShader9 *mVertexExecutable;
gl::D3DConstantTable *mConstantTable; D3DConstantTable *mConstantTable;
}; };
} }
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include "libGLESv2/Context.h" #include "libGLESv2/Context.h"
namespace gl namespace rx
{ {
struct TranslatedAttribute struct TranslatedAttribute
...@@ -64,7 +64,7 @@ class ArrayVertexBuffer : public VertexBuffer ...@@ -64,7 +64,7 @@ class ArrayVertexBuffer : public VertexBuffer
~ArrayVertexBuffer(); ~ArrayVertexBuffer();
std::size_t size() const { return mBufferSize; } std::size_t size() const { return mBufferSize; }
virtual void *map(const VertexAttribute &attribute, std::size_t requiredSpace, std::size_t *streamOffset) = 0; virtual void *map(const gl::VertexAttribute &attribute, std::size_t requiredSpace, std::size_t *streamOffset) = 0;
virtual void reserveRequiredSpace() = 0; virtual void reserveRequiredSpace() = 0;
void addRequiredSpace(UINT requiredSpace); void addRequiredSpace(UINT requiredSpace);
...@@ -80,7 +80,7 @@ class StreamingVertexBuffer : public ArrayVertexBuffer ...@@ -80,7 +80,7 @@ class StreamingVertexBuffer : public ArrayVertexBuffer
StreamingVertexBuffer(rx::Renderer9 *renderer, std::size_t initialSize); StreamingVertexBuffer(rx::Renderer9 *renderer, std::size_t initialSize);
~StreamingVertexBuffer(); ~StreamingVertexBuffer();
void *map(const VertexAttribute &attribute, std::size_t requiredSpace, std::size_t *streamOffset); void *map(const gl::VertexAttribute &attribute, std::size_t requiredSpace, std::size_t *streamOffset);
void reserveRequiredSpace(); void reserveRequiredSpace();
}; };
...@@ -90,10 +90,10 @@ class StaticVertexBuffer : public ArrayVertexBuffer ...@@ -90,10 +90,10 @@ class StaticVertexBuffer : public ArrayVertexBuffer
explicit StaticVertexBuffer(rx::Renderer9 *renderer); explicit StaticVertexBuffer(rx::Renderer9 *renderer);
~StaticVertexBuffer(); ~StaticVertexBuffer();
void *map(const VertexAttribute &attribute, std::size_t requiredSpace, std::size_t *streamOffset); void *map(const gl::VertexAttribute &attribute, std::size_t requiredSpace, std::size_t *streamOffset);
void reserveRequiredSpace(); void reserveRequiredSpace();
std::size_t lookupAttribute(const VertexAttribute &attribute); // Returns the offset into the vertex buffer, or -1 if not found std::size_t lookupAttribute(const gl::VertexAttribute &attribute); // Returns the offset into the vertex buffer, or -1 if not found
private: private:
struct VertexElement struct VertexElement
...@@ -116,21 +116,21 @@ class VertexDataManager ...@@ -116,21 +116,21 @@ class VertexDataManager
VertexDataManager(rx::Renderer9 *renderer); VertexDataManager(rx::Renderer9 *renderer);
virtual ~VertexDataManager(); virtual ~VertexDataManager();
GLenum prepareVertexData(const VertexAttribute attribs[], ProgramBinary *programBinary, GLint start, GLsizei count, TranslatedAttribute *outAttribs, GLsizei instances); GLenum prepareVertexData(const gl::VertexAttribute attribs[], gl::ProgramBinary *programBinary, GLint start, GLsizei count, TranslatedAttribute *outAttribs, GLsizei instances);
private: private:
DISALLOW_COPY_AND_ASSIGN(VertexDataManager); DISALLOW_COPY_AND_ASSIGN(VertexDataManager);
std::size_t spaceRequired(const VertexAttribute &attrib, std::size_t count, GLsizei instances) const; std::size_t spaceRequired(const gl::VertexAttribute &attrib, std::size_t count, GLsizei instances) const;
std::size_t writeAttributeData(ArrayVertexBuffer *vertexBuffer, GLint start, GLsizei count, const VertexAttribute &attribute, GLsizei instances); std::size_t writeAttributeData(ArrayVertexBuffer *vertexBuffer, GLint start, GLsizei count, const gl::VertexAttribute &attribute, GLsizei instances);
rx::Renderer9 *const mRenderer; // D3D9_REPLACE rx::Renderer9 *const mRenderer; // D3D9_REPLACE
StreamingVertexBuffer *mStreamingBuffer; StreamingVertexBuffer *mStreamingBuffer;
float mCurrentValue[MAX_VERTEX_ATTRIBS][4]; float mCurrentValue[gl::MAX_VERTEX_ATTRIBS][4];
StreamingVertexBuffer *mCurrentValueBuffer[MAX_VERTEX_ATTRIBS]; StreamingVertexBuffer *mCurrentValueBuffer[gl::MAX_VERTEX_ATTRIBS];
std::size_t mCurrentValueOffsets[MAX_VERTEX_ATTRIBS]; std::size_t mCurrentValueOffsets[gl::MAX_VERTEX_ATTRIBS];
// Attribute format conversion // Attribute format conversion
struct FormatConverter struct FormatConverter
...@@ -158,7 +158,7 @@ class VertexDataManager ...@@ -158,7 +158,7 @@ class VertexDataManager
void checkVertexCaps(DWORD declTypes); void checkVertexCaps(DWORD declTypes);
unsigned int typeIndex(GLenum type) const; unsigned int typeIndex(GLenum type) const;
const FormatConverter &formatConverter(const VertexAttribute &attribute) const; const FormatConverter &formatConverter(const gl::VertexAttribute &attribute) const;
}; };
} }
......
...@@ -41,7 +41,7 @@ VertexDeclarationCache::~VertexDeclarationCache() ...@@ -41,7 +41,7 @@ VertexDeclarationCache::~VertexDeclarationCache()
} }
} }
GLenum VertexDeclarationCache::applyDeclaration(IDirect3DDevice9 *device, gl::TranslatedAttribute attributes[], gl::ProgramBinary *programBinary, GLsizei instances, GLsizei *repeatDraw) GLenum VertexDeclarationCache::applyDeclaration(IDirect3DDevice9 *device, TranslatedAttribute attributes[], gl::ProgramBinary *programBinary, GLsizei instances, GLsizei *repeatDraw)
{ {
*repeatDraw = 1; *repeatDraw = 1;
......
...@@ -26,7 +26,7 @@ class VertexDeclarationCache ...@@ -26,7 +26,7 @@ class VertexDeclarationCache
VertexDeclarationCache(); VertexDeclarationCache();
~VertexDeclarationCache(); ~VertexDeclarationCache();
GLenum applyDeclaration(IDirect3DDevice9 *device, gl::TranslatedAttribute attributes[], gl::ProgramBinary *programBinary, GLsizei instances, GLsizei *repeatDraw); GLenum applyDeclaration(IDirect3DDevice9 *device, TranslatedAttribute attributes[], gl::ProgramBinary *programBinary, GLsizei instances, GLsizei *repeatDraw);
void markStateDirty(); void markStateDirty();
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include "libGLESv2/Context.h" // Defines Index #include "libGLESv2/Context.h" // Defines Index
namespace gl namespace rx
{ {
// Conversion types: // Conversion types:
......
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