Fixed GL renderer for Intel SandyBridge.

This commit is contained in:
bkaradzic 2012-12-29 13:46:25 -08:00
Родитель 8b8877582a
Коммит ff41632999
3 изменённых файлов: 16 добавлений и 14 удалений

Просмотреть файл

@ -394,9 +394,9 @@ namespace bgfx
Count Count
}; };
uint8_t m_type; uint32_t m_loc;
uint16_t m_loc;
uint16_t m_count; uint16_t m_count;
uint8_t m_type;
}; };
const char* getPredefinedUniformName(PredefinedUniform::Enum _enum); const char* getPredefinedUniformName(PredefinedUniform::Enum _enum);

Просмотреть файл

@ -1116,7 +1116,8 @@ namespace bgfx
{ {
data = info->m_data; data = info->m_data;
UniformType::Enum type = convertGlType(gltype); UniformType::Enum type = convertGlType(gltype);
m_constantBuffer->writeUniformRef(type, loc, data, num); m_constantBuffer->writeUniformRef(type, 0, data, num);
m_constantBuffer->write(loc);
BX_TRACE("store %s %p", name, data); BX_TRACE("store %s %p", name, data);
} }
} }
@ -1141,8 +1142,8 @@ namespace bgfx
uint32_t used = 0; uint32_t used = 0;
for (uint32_t ii = 0; ii < Attrib::Count; ++ii) for (uint32_t ii = 0; ii < Attrib::Count; ++ii)
{ {
GLuint loc = glGetAttribLocation(m_id, s_attribName[ii]); GLint loc = glGetAttribLocation(m_id, s_attribName[ii]);
if (GLuint(-1) != loc ) if (-1 != loc)
{ {
BX_TRACE("attr %s: %d", s_attribName[ii], loc); BX_TRACE("attr %s: %d", s_attribName[ii], loc);
m_attributes[ii] = loc; m_attributes[ii] = loc;
@ -1170,14 +1171,14 @@ namespace bgfx
for (uint32_t ii = 0; Attrib::Count != m_used[ii]; ++ii) for (uint32_t ii = 0; Attrib::Count != m_used[ii]; ++ii)
{ {
Attrib::Enum attr = Attrib::Enum(m_used[ii]); Attrib::Enum attr = Attrib::Enum(m_used[ii]);
GLuint loc = m_attributes[attr]; GLint loc = m_attributes[attr];
uint8_t num; uint8_t num;
AttribType::Enum type; AttribType::Enum type;
bool normalized; bool normalized;
_vertexDecl.decode(attr, num, type, normalized); _vertexDecl.decode(attr, num, type, normalized);
if (0xffff != loc if (-1 != loc
&& 0xff != _vertexDecl.m_attributes[attr]) && 0xff != _vertexDecl.m_attributes[attr])
{ {
GL_CHECK(glEnableVertexAttribArray(loc) ); GL_CHECK(glEnableVertexAttribArray(loc) );
@ -1223,7 +1224,7 @@ namespace bgfx
uint32_t baseVertex = _baseVertex; uint32_t baseVertex = _baseVertex;
for (uint32_t ii = 0; 0xffff != m_instanceData[ii]; ++ii) for (uint32_t ii = 0; 0xffff != m_instanceData[ii]; ++ii)
{ {
GLuint loc = m_instanceData[ii]; GLint loc = m_instanceData[ii];
GL_CHECK(glEnableVertexAttribArray(loc) ); GL_CHECK(glEnableVertexAttribArray(loc) );
GL_CHECK(glVertexAttribPointer(loc, 4, GL_FLOAT, GL_FALSE, _stride, (void*)(uintptr_t)baseVertex) ); GL_CHECK(glVertexAttribPointer(loc, 4, GL_FLOAT, GL_FALSE, _stride, (void*)(uintptr_t)baseVertex) );
GL_CHECK(s_vertexAttribDivisor(loc, 1) ); GL_CHECK(s_vertexAttribDivisor(loc, 1) );
@ -1855,10 +1856,10 @@ namespace bgfx
} }
UniformType::Enum type; UniformType::Enum type;
uint16_t loc; uint16_t ignore;
uint16_t num; uint16_t num;
uint16_t copy; uint16_t copy;
decodeOpcode(opcode, type, loc, num, copy); decodeOpcode(opcode, type, ignore, num, copy);
const char* data; const char* data;
if (copy) if (copy)
@ -1870,6 +1871,8 @@ namespace bgfx
memcpy(&data, read(sizeof(void*) ), sizeof(void*) ); memcpy(&data, read(sizeof(void*) ), sizeof(void*) );
} }
uint32_t loc = read();
#define CASE_IMPLEMENT_UNIFORM(_uniform, _glsuffix, _dxsuffix, _type) \ #define CASE_IMPLEMENT_UNIFORM(_uniform, _glsuffix, _dxsuffix, _type) \
case UniformType::_uniform: \ case UniformType::_uniform: \
{ \ { \

Просмотреть файл

@ -432,11 +432,10 @@ namespace bgfx
GLuint m_id; GLuint m_id;
uint8_t m_used[Attrib::Count+1]; // dense uint8_t m_used[Attrib::Count+1]; // dense
uint16_t m_attributes[Attrib::Count]; // sparse GLint m_attributes[Attrib::Count]; // sparse
uint16_t m_instanceData[BGFX_CONFIG_MAX_INSTANCE_DATA_COUNT]; GLint m_instanceData[BGFX_CONFIG_MAX_INSTANCE_DATA_COUNT];
uint32_t m_enabled;
GLuint m_sampler[BGFX_CONFIG_MAX_TEXTURES]; GLint m_sampler[BGFX_CONFIG_MAX_TEXTURES];
uint8_t m_numSamplers; uint8_t m_numSamplers;
ConstantBuffer* m_constantBuffer; ConstantBuffer* m_constantBuffer;