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)
if (usage == GL_STATIC_DRAW)
{
mStaticVertexBuffer = new StaticVertexBuffer(mRenderer);
mStaticIndexBuffer = new StaticIndexBuffer(mRenderer);
mStaticVertexBuffer = new rx::StaticVertexBuffer(mRenderer);
mStaticIndexBuffer = new rx::StaticIndexBuffer(mRenderer);
}
}
......@@ -78,12 +78,12 @@ void Buffer::bufferSubData(const void *data, GLsizeiptr size, GLintptr offset)
mUnmodifiedDataUse = 0;
}
StaticVertexBuffer *Buffer::getStaticVertexBuffer()
rx::StaticVertexBuffer *Buffer::getStaticVertexBuffer()
{
return mStaticVertexBuffer;
}
StaticIndexBuffer *Buffer::getStaticIndexBuffer()
rx::StaticIndexBuffer *Buffer::getStaticIndexBuffer()
{
return mStaticIndexBuffer;
}
......@@ -108,8 +108,8 @@ void Buffer::promoteStaticUsage(int dataSize)
if (mUnmodifiedDataUse > 3 * mSize)
{
mStaticVertexBuffer = new StaticVertexBuffer(mRenderer);
mStaticIndexBuffer = new StaticIndexBuffer(mRenderer);
mStaticVertexBuffer = new rx::StaticVertexBuffer(mRenderer);
mStaticIndexBuffer = new rx::StaticIndexBuffer(mRenderer);
}
}
}
......
......@@ -21,10 +21,14 @@
#include "common/RefCountObject.h"
#include "libGLESv2/renderer/Renderer9.h"
namespace gl
namespace rx
{
class StaticVertexBuffer;
class StaticIndexBuffer;
}
namespace gl
{
class Buffer : public RefCountObject
{
......@@ -40,8 +44,8 @@ class Buffer : public RefCountObject
size_t size() const { return mSize; }
GLenum usage() const { return mUsage; }
StaticVertexBuffer *getStaticVertexBuffer();
StaticIndexBuffer *getStaticIndexBuffer();
rx::StaticVertexBuffer *getStaticVertexBuffer();
rx::StaticIndexBuffer *getStaticIndexBuffer();
void invalidateStaticData();
void promoteStaticUsage(int dataSize);
......@@ -53,8 +57,8 @@ class Buffer : public RefCountObject
GLsizeiptr mSize;
GLenum mUsage;
StaticVertexBuffer *mStaticVertexBuffer;
StaticIndexBuffer *mStaticIndexBuffer;
rx::StaticVertexBuffer *mStaticVertexBuffer;
rx::StaticIndexBuffer *mStaticIndexBuffer;
GLsizeiptr mUnmodifiedDataUse;
};
......
......@@ -2040,7 +2040,7 @@ void Context::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid
applyState(mode);
TranslatedIndexData indexInfo;
rx::TranslatedIndexData indexInfo;
GLenum err = mRenderer->applyIndexBuffer(indices, mState.elementArrayBuffer.get(), count, mode, type, &indexInfo);
if (err != GL_NO_ERROR)
{
......
......@@ -1817,8 +1817,8 @@ bool ProgramBinary::link(InfoLog &infoLog, const AttributeBindings &attributeBin
}
bool success = true;
D3DConstantTable *constantTableVS = NULL;
D3DConstantTable *constantTablePS = NULL;
rx::D3DConstantTable *constantTableVS = NULL;
rx::D3DConstantTable *constantTablePS = NULL;
mVertexExecutable = mRenderer->compileToExecutable(infoLog, vertexHLSL.c_str(), GL_VERTEX_SHADER);
mPixelExecutable = mRenderer->compileToExecutable(infoLog, pixelHLSL.c_str(), GL_FRAGMENT_SHADER);
......@@ -1937,11 +1937,11 @@ bool ProgramBinary::linkAttributes(InfoLog &infoLog, const AttributeBindings &at
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++)
{
const D3DConstant *constant = psConstantTable->getConstant(constantIndex);
const rx::D3DConstant *constant = psConstantTable->getConstant(constantIndex);
if (!defineUniform(infoLog, GL_FRAGMENT_SHADER, constant, "", vsConstantTable, psConstantTable))
{
......@@ -1951,7 +1951,7 @@ bool ProgramBinary::linkUniforms(InfoLog &infoLog, D3DConstantTable *vsConstantT
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))
{
......@@ -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
// Returns true if succesful (uniform not already defined)
bool ProgramBinary::defineUniform(InfoLog &infoLog, GLenum shader, const D3DConstant *constant, const std::string &name,
D3DConstantTable *vsConstantTable, D3DConstantTable *psConstantTable)
bool ProgramBinary::defineUniform(InfoLog &infoLog, GLenum shader, const rx::D3DConstant *constant, const std::string &name,
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++)
{
const D3DConstant *psConstant = psConstantTable->getConstantByName(constant->name.c_str());
const D3DConstant *vsConstant = vsConstantTable->getConstantByName(constant->name.c_str());
const rx::D3DConstant *psConstant = psConstantTable->getConstantByName(constant->name.c_str());
const rx::D3DConstant *vsConstant = vsConstantTable->getConstantByName(constant->name.c_str());
if (psConstant)
{
......@@ -1980,7 +1980,7 @@ bool ProgramBinary::defineUniform(InfoLog &infoLog, GLenum shader, const D3DCons
if (samplerIndex < MAX_TEXTURE_IMAGE_UNITS)
{
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;
mUsedPixelSamplerRange = std::max(samplerIndex + 1, mUsedPixelSamplerRange);
}
......@@ -1998,7 +1998,7 @@ bool ProgramBinary::defineUniform(InfoLog &infoLog, GLenum shader, const D3DCons
if (samplerIndex < getContext()->getMaximumVertexTextureImageUnits())
{
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;
mUsedVertexSamplerRange = std::max(samplerIndex + 1, mUsedVertexSamplerRange);
}
......@@ -2013,13 +2013,13 @@ bool ProgramBinary::defineUniform(InfoLog &infoLog, GLenum shader, const D3DCons
switch(constant->typeClass)
{
case D3DConstant::CLASS_STRUCT:
case rx::D3DConstant::CLASS_STRUCT:
{
for (unsigned int arrayIndex = 0; arrayIndex < constant->elements; arrayIndex++)
{
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) + "]") : "";
......@@ -2032,10 +2032,10 @@ bool ProgramBinary::defineUniform(InfoLog &infoLog, GLenum shader, const D3DCons
return true;
}
case D3DConstant::CLASS_SCALAR:
case D3DConstant::CLASS_VECTOR:
case D3DConstant::CLASS_MATRIX_COLUMNS:
case D3DConstant::CLASS_OBJECT:
case rx::D3DConstant::CLASS_SCALAR:
case rx::D3DConstant::CLASS_VECTOR:
case rx::D3DConstant::CLASS_MATRIX_COLUMNS:
case rx::D3DConstant::CLASS_OBJECT:
return defineUniform(shader, constant, name + constant->name);
default:
UNREACHABLE();
......@@ -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);
......@@ -2081,27 +2081,27 @@ bool ProgramBinary::defineUniform(GLenum shader, const D3DConstant *constant, co
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
{
switch (constant->type)
{
case D3DConstant::PT_SAMPLER2D:
case rx::D3DConstant::PT_SAMPLER2D:
switch (constant->columns)
{
case 1: return new Uniform(GL_SAMPLER_2D, _name, constant->elements);
default: UNREACHABLE();
}
break;
case D3DConstant::PT_SAMPLERCUBE:
case rx::D3DConstant::PT_SAMPLERCUBE:
switch (constant->columns)
{
case 1: return new Uniform(GL_SAMPLER_CUBE, _name, constant->elements);
default: UNREACHABLE();
}
break;
case D3DConstant::PT_BOOL:
case rx::D3DConstant::PT_BOOL:
switch (constant->columns)
{
case 1: return new Uniform(GL_BOOL, _name, constant->elements);
......@@ -2111,7 +2111,7 @@ Uniform *ProgramBinary::createUniform(const D3DConstant *constant, const std::st
default: UNREACHABLE();
}
break;
case D3DConstant::PT_INT:
case rx::D3DConstant::PT_INT:
switch (constant->columns)
{
case 1: return new Uniform(GL_INT, _name, constant->elements);
......@@ -2121,7 +2121,7 @@ Uniform *ProgramBinary::createUniform(const D3DConstant *constant, const std::st
default: UNREACHABLE();
}
break;
case D3DConstant::PT_FLOAT:
case rx::D3DConstant::PT_FLOAT:
switch (constant->columns)
{
case 1: return new Uniform(GL_FLOAT, _name, constant->elements);
......@@ -2139,7 +2139,7 @@ Uniform *ProgramBinary::createUniform(const D3DConstant *constant, const std::st
{
switch (constant->type)
{
case D3DConstant::PT_FLOAT:
case rx::D3DConstant::PT_FLOAT:
switch (constant->rows)
{
case 2: return new Uniform(GL_FLOAT_MAT2, _name, constant->elements);
......
......@@ -56,13 +56,13 @@ struct Uniform
registerCount = 0;
}
void set(const D3DConstant *constant)
void set(const rx::D3DConstant *constant)
{
switch(constant->registerSet)
{
case D3DConstant::RS_BOOL: boolIndex = constant->registerIndex; break;
case D3DConstant::RS_FLOAT4: float4Index = constant->registerIndex; break;
case D3DConstant::RS_SAMPLER: samplerIndex = constant->registerIndex; break;
case rx::D3DConstant::RS_BOOL: boolIndex = constant->registerIndex; break;
case rx::D3DConstant::RS_FLOAT4: float4Index = constant->registerIndex; break;
case rx::D3DConstant::RS_SAMPLER: samplerIndex = constant->registerIndex; break;
default: UNREACHABLE();
}
......@@ -171,11 +171,11 @@ class ProgramBinary : public RefCountObject
bool linkAttributes(InfoLog &infoLog, const AttributeBindings &attributeBindings, FragmentShader *fragmentShader, VertexShader *vertexShader);
bool linkUniforms(InfoLog &infoLog, D3DConstantTable *vsConstantTable, D3DConstantTable *psConstantTable);
bool defineUniform(InfoLog &infoLog, GLenum shader, const D3DConstant *constant, const std::string &name,
D3DConstantTable *vsConstantTable, D3DConstantTable *psConstantTable);
bool defineUniform(GLenum shader, const D3DConstant *constant, const std::string &name);
Uniform *createUniform( const D3DConstant *constant, const std::string &name);
bool linkUniforms(InfoLog &infoLog, rx::D3DConstantTable *vsConstantTable, rx::D3DConstantTable *psConstantTable);
bool defineUniform(InfoLog &infoLog, GLenum shader, const rx::D3DConstant *constant, const std::string &name,
rx::D3DConstantTable *vsConstantTable, rx::D3DConstantTable *psConstantTable);
bool defineUniform(GLenum shader, const rx::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 applyUniform1iv(IDirect3DDevice9 *device, Uniform *targetUniform, GLsizei count, const GLint *v);
bool applyUniform2iv(IDirect3DDevice9 *device, Uniform *targetUniform, GLsizei count, const GLint *v);
......
......@@ -21,7 +21,7 @@
const static int SHADER_VERSION_MASK = D3DVS_VERSION(0, 0);
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.
// They match the corresponding structures in d3dx9shader.h.
......@@ -147,7 +147,7 @@ unsigned D3DConstant::addStructMembers(const char *base, RegisterSet registerSet
D3DConstantTable::D3DConstantTable(void *blob, size_t size) : mError(false)
{
BinaryInputStream stream(blob, size);
gl::BinaryInputStream stream(blob, size);
int version;
stream.read(&version);
......
......@@ -17,7 +17,7 @@
#include "common/angleutils.h"
namespace gl
namespace rx
{
namespace ctab
......
......@@ -15,7 +15,7 @@
#include "libGLESv2/mathutil.h"
#include "libGLESv2/main.h"
namespace gl
namespace rx
{
unsigned int IndexBuffer::mCurrentSerial = 1;
......@@ -107,7 +107,7 @@ void computeRange(GLenum type, const GLvoid *indices, GLsizei count, GLuint *min
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)
{
......
......@@ -23,7 +23,7 @@ namespace
enum { INITIAL_INDEX_BUFFER_SIZE = 4096 * sizeof(GLuint) };
}
namespace gl
namespace rx
{
struct TranslatedIndexData
......@@ -125,7 +125,7 @@ class IndexDataManager
IndexDataManager(rx::Renderer9 *renderer);
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);
private:
......
......@@ -47,7 +47,6 @@ class InfoLog;
class ProgramBinary;
class VertexAttribute;
class Buffer;
struct TranslatedIndexData;
}
namespace rx
......@@ -55,6 +54,7 @@ namespace rx
class TextureStorage2D;
class TextureStorageCubeMap;
class Blit;
struct TranslatedIndexData;
struct ConfigDesc
{
......@@ -97,10 +97,10 @@ class Renderer
virtual void applyShaders(gl::ProgramBinary *programBinary) = 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 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 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;
......
......@@ -664,7 +664,7 @@ GLenum Renderer11::applyVertexBuffer(gl::ProgramBinary *programBinary, gl::Verte
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
UNIMPLEMENTED();
......@@ -677,7 +677,7 @@ void Renderer11::drawArrays(GLenum mode, GLsizei count, GLsizei instances)
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
UNIMPLEMENTED();
......
......@@ -63,10 +63,10 @@ class Renderer11 : public Renderer
virtual bool applyRenderTarget(gl::Framebuffer *frameBuffer);
virtual void applyShaders(gl::ProgramBinary *programBinary);
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 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);
......
......@@ -379,8 +379,8 @@ void Renderer9::initializeDevice()
ASSERT(!mBlit && !mVertexDataManager && !mIndexDataManager);
mBlit = new Blit(this);
mVertexDataManager = new gl::VertexDataManager(this);
mIndexDataManager = new gl::IndexDataManager(this);
mVertexDataManager = new rx::VertexDataManager(this);
mIndexDataManager = new rx::IndexDataManager(this);
}
D3DPRESENT_PARAMETERS Renderer9::getDefaultPresentParameters()
......@@ -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)
{
gl::TranslatedAttribute attributes[gl::MAX_VERTEX_ATTRIBS];
TranslatedAttribute attributes[gl::MAX_VERTEX_ATTRIBS];
GLenum err = mVertexDataManager->prepareVertexData(vertexAttributes, programBinary, first, count, attributes, instances);
if (err != GL_NO_ERROR)
{
......@@ -1135,7 +1135,7 @@ GLenum Renderer9::applyVertexBuffer(gl::ProgramBinary *programBinary, gl::Vertex
}
// 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;
unsigned int serial;
......@@ -1163,7 +1163,7 @@ void Renderer9::drawArrays(GLenum mode, GLsizei count, GLsizei instances)
}
else if (instances > 0)
{
gl::StaticIndexBuffer *countingIB = mIndexDataManager->getCountingIndices(count);
StaticIndexBuffer *countingIB = mIndexDataManager->getCountingIndices(count);
if (countingIB)
{
if (mAppliedIBSerial != countingIB->getSerial())
......@@ -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();
......@@ -1226,7 +1226,7 @@ void Renderer9::drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices,
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)
......@@ -1283,7 +1283,7 @@ void Renderer9::drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices,
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)
......@@ -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)
{
ShaderExecutable9 *executable = NULL;
gl::D3DConstantTable *table = reinterpret_cast<gl::D3DConstantTable *>(data);
D3DConstantTable *table = reinterpret_cast<D3DConstantTable *>(data);
switch (type)
{
......@@ -2669,7 +2669,7 @@ ShaderExecutable *Renderer9::compileToExecutable(gl::InfoLog &infoLog, const cha
if (!binary)
return NULL;
gl::D3DConstantTable *constantTable = new gl::D3DConstantTable(binary->GetBufferPointer(), binary->GetBufferSize());
D3DConstantTable *constantTable = new D3DConstantTable(binary->GetBufferPointer(), binary->GetBufferSize());
if (constantTable->error())
{
delete constantTable;
......
......@@ -28,16 +28,12 @@
#include "libGLESv2/renderer/Renderer.h"
#include "libGLESv2/renderer/IndexDataManager.h"
namespace gl
namespace rx
{
class D3DConstantTable;
class VertexDataManager;
class StreamingIndexBuffer;
struct TranslatedAttribute;
}
namespace rx
{
class Renderer9 : public Renderer
{
......@@ -96,10 +92,10 @@ class Renderer9 : public Renderer
virtual void applyShaders(gl::ProgramBinary *programBinary);
virtual bool applyPrimitiveType(GLenum primitiveType, GLsizei elementCount);
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 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);
......@@ -265,11 +261,11 @@ class Renderer9 : public Renderer
VertexShaderCache mVertexShaderCache;
PixelShaderCache mPixelShaderCache;
gl::VertexDataManager *mVertexDataManager;
VertexDataManager *mVertexDataManager;
VertexDeclarationCache mVertexDeclarationCache;
gl::IndexDataManager *mIndexDataManager;
gl::StreamingIndexBuffer *mLineLoopIB;
IndexDataManager *mIndexDataManager;
StreamingIndexBuffer *mLineLoopIB;
};
}
......
......@@ -40,7 +40,7 @@ class ShaderExecutable
return mLength;
}
virtual gl::D3DConstantTable *getConstantTable() = 0; // D3D9_REMOVE
virtual D3DConstantTable *getConstantTable() = 0; // D3D9_REMOVE
private:
DISALLOW_COPY_AND_ASSIGN(ShaderExecutable);
......
......@@ -56,7 +56,7 @@ ID3D11PixelShader *ShaderExecutable11::getPixelShader()
return mPixelExecutable;
}
gl::D3DConstantTable *ShaderExecutable11::getConstantTable()
D3DConstantTable *ShaderExecutable11::getConstantTable()
{
return NULL;
}
......
......@@ -29,7 +29,7 @@ class ShaderExecutable11 : public ShaderExecutable
ID3D11PixelShader *getPixelShader();
ID3D11VertexShader *getVertexShader();
virtual gl::D3DConstantTable *getConstantTable();
virtual D3DConstantTable *getConstantTable();
private:
DISALLOW_COPY_AND_ASSIGN(ShaderExecutable11);
......
......@@ -14,7 +14,7 @@
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)
{
mPixelExecutable = executable;
......@@ -22,7 +22,7 @@ ShaderExecutable9::ShaderExecutable9(const void *function, size_t length, IDirec
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)
{
mVertexExecutable = executable;
......@@ -60,7 +60,7 @@ IDirect3DPixelShader9 *ShaderExecutable9::getPixelShader()
return mPixelExecutable;
}
gl::D3DConstantTable *ShaderExecutable9::getConstantTable()
D3DConstantTable *ShaderExecutable9::getConstantTable()
{
return mConstantTable;
}
......
......@@ -21,15 +21,15 @@ namespace rx
class ShaderExecutable9 : public ShaderExecutable
{
public:
ShaderExecutable9(const void *function, size_t length, IDirect3DPixelShader9 *executable, gl::D3DConstantTable *constantTable);
ShaderExecutable9(const void *function, size_t length, IDirect3DVertexShader9 *executable, gl::D3DConstantTable *constantTable);
ShaderExecutable9(const void *function, size_t length, IDirect3DPixelShader9 *executable, D3DConstantTable *constantTable);
ShaderExecutable9(const void *function, size_t length, IDirect3DVertexShader9 *executable, D3DConstantTable *constantTable);
virtual ~ShaderExecutable9();
static ShaderExecutable9 *makeShaderExecutable9(ShaderExecutable *executable);
IDirect3DPixelShader9 *getPixelShader();
IDirect3DVertexShader9 *getVertexShader();
virtual gl::D3DConstantTable *getConstantTable();
virtual D3DConstantTable *getConstantTable();
private:
DISALLOW_COPY_AND_ASSIGN(ShaderExecutable9);
......@@ -37,7 +37,7 @@ class ShaderExecutable9 : public ShaderExecutable
IDirect3DPixelShader9 *mPixelExecutable;
IDirect3DVertexShader9 *mVertexExecutable;
gl::D3DConstantTable *mConstantTable;
D3DConstantTable *mConstantTable;
};
}
......
......@@ -18,7 +18,7 @@
#include "libGLESv2/Context.h"
namespace gl
namespace rx
{
struct TranslatedAttribute
......@@ -64,7 +64,7 @@ class ArrayVertexBuffer : public VertexBuffer
~ArrayVertexBuffer();
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;
void addRequiredSpace(UINT requiredSpace);
......@@ -80,7 +80,7 @@ class StreamingVertexBuffer : public ArrayVertexBuffer
StreamingVertexBuffer(rx::Renderer9 *renderer, std::size_t initialSize);
~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();
};
......@@ -90,10 +90,10 @@ class StaticVertexBuffer : public ArrayVertexBuffer
explicit StaticVertexBuffer(rx::Renderer9 *renderer);
~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();
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:
struct VertexElement
......@@ -116,21 +116,21 @@ class VertexDataManager
VertexDataManager(rx::Renderer9 *renderer);
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:
DISALLOW_COPY_AND_ASSIGN(VertexDataManager);
std::size_t spaceRequired(const 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 spaceRequired(const gl::VertexAttribute &attrib, std::size_t count, GLsizei instances) const;
std::size_t writeAttributeData(ArrayVertexBuffer *vertexBuffer, GLint start, GLsizei count, const gl::VertexAttribute &attribute, GLsizei instances);
rx::Renderer9 *const mRenderer; // D3D9_REPLACE
StreamingVertexBuffer *mStreamingBuffer;
float mCurrentValue[MAX_VERTEX_ATTRIBS][4];
StreamingVertexBuffer *mCurrentValueBuffer[MAX_VERTEX_ATTRIBS];
std::size_t mCurrentValueOffsets[MAX_VERTEX_ATTRIBS];
float mCurrentValue[gl::MAX_VERTEX_ATTRIBS][4];
StreamingVertexBuffer *mCurrentValueBuffer[gl::MAX_VERTEX_ATTRIBS];
std::size_t mCurrentValueOffsets[gl::MAX_VERTEX_ATTRIBS];
// Attribute format conversion
struct FormatConverter
......@@ -158,7 +158,7 @@ class VertexDataManager
void checkVertexCaps(DWORD declTypes);
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()
}
}
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;
......
......@@ -26,7 +26,7 @@ class 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();
......
......@@ -15,7 +15,7 @@
#include "libGLESv2/Context.h" // Defines Index
namespace gl
namespace rx
{
// 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