Cleanup.
This commit is contained in:
parent
9c5a236230
commit
5555c73b3a
@ -3442,13 +3442,13 @@ namespace bgfx { namespace gl
|
||||
GL_CHECK(glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE) );
|
||||
|
||||
ProgramGL& program = m_program[_blitter.m_program.idx];
|
||||
GlUseProgram(program.m_id);
|
||||
GlUniform1i(program.m_sampler[0].loc, 0);
|
||||
setProgram(program.m_id);
|
||||
setUnifom1i(program.m_sampler[0].loc, 0);
|
||||
|
||||
float proj[16];
|
||||
bx::mtxOrtho(proj, 0.0f, (float)width, (float)height, 0.0f, 0.0f, 1000.0f, 0.0f, g_caps.homogeneousDepth);
|
||||
|
||||
GlUniformMatrix4fv(program.m_predefined[0].m_loc
|
||||
setUnifomMatrix4fv(program.m_predefined[0].m_loc
|
||||
, 1
|
||||
, GL_FALSE
|
||||
, proj
|
||||
@ -3553,7 +3553,7 @@ namespace bgfx { namespace gl
|
||||
|
||||
void setShaderUniform4f(uint8_t /*_flags*/, uint32_t _regIndex, const void* _val, uint32_t _numRegs)
|
||||
{
|
||||
GlUniform4fv(_regIndex
|
||||
setUnifom4fv(_regIndex
|
||||
, _numRegs
|
||||
, (const GLfloat*)_val
|
||||
);
|
||||
@ -3561,7 +3561,7 @@ namespace bgfx { namespace gl
|
||||
|
||||
void setShaderUniform4x4f(uint8_t /*_flags*/, uint32_t _regIndex, const void* _val, uint32_t _numRegs)
|
||||
{
|
||||
GlUniformMatrix4fv(_regIndex
|
||||
setUnifomMatrix4fv(_regIndex
|
||||
, _numRegs
|
||||
, GL_FALSE
|
||||
, (const GLfloat*)_val
|
||||
@ -4029,7 +4029,7 @@ namespace bgfx { namespace gl
|
||||
case UniformType::_uniform: \
|
||||
{ \
|
||||
_type* value = (_type*)data; \
|
||||
GlUniform##_glsuffix(loc, num, value); \
|
||||
setUnifom##_glsuffix(loc, num, value); \
|
||||
} \
|
||||
break;
|
||||
|
||||
@ -4037,7 +4037,7 @@ namespace bgfx { namespace gl
|
||||
case UniformType::_uniform: \
|
||||
{ \
|
||||
_type* value = (_type*)data; \
|
||||
GlUniform##_glsuffix(loc, num, GL_FALSE, value); \
|
||||
setUnifom##_glsuffix(loc, num, GL_FALSE, value); \
|
||||
} \
|
||||
break;
|
||||
|
||||
@ -4048,12 +4048,12 @@ namespace bgfx { namespace gl
|
||||
// since they need to marshal an array over from Wasm to JS, so optimize the case when there is exactly one
|
||||
// uniform to upload.
|
||||
case UniformType::Sampler:
|
||||
if (num > 1) GlUniform1iv(loc, num, (int*)data);
|
||||
else GlUniform1i(loc, *(int*)data);
|
||||
if (num > 1) setUnifom1iv(loc, num, (int*)data);
|
||||
else setUnifom1i(loc, *(int*)data);
|
||||
break;
|
||||
case UniformType::Vec4:
|
||||
if (num > 1) GlUniform4fv(loc, num, (float*)data);
|
||||
else GlUniform4f(loc, ((float*)data)[0], ((float*)data)[1], ((float*)data)[2], ((float*)data)[3]);
|
||||
if (num > 1) setUnifom4fv(loc, num, (float*)data);
|
||||
else setUnifom4f(loc, ((float*)data)[0], ((float*)data)[1], ((float*)data)[2], ((float*)data)[3]);
|
||||
break;
|
||||
#else
|
||||
CASE_IMPLEMENT_UNIFORM(Sampler, 1iv, I, int);
|
||||
@ -4178,7 +4178,7 @@ namespace bgfx { namespace gl
|
||||
GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, vb.m_id) );
|
||||
|
||||
ProgramGL& program = m_program[_clearQuad.m_program[numMrt-1].idx];
|
||||
GlUseProgram(program.m_id);
|
||||
setProgram(program.m_id);
|
||||
program.bindAttributesBegin();
|
||||
program.bindAttributes(layout, 0);
|
||||
program.bindAttributesEnd();
|
||||
@ -4237,7 +4237,7 @@ namespace bgfx { namespace gl
|
||||
}
|
||||
}
|
||||
|
||||
void GlUseProgram(GLuint program)
|
||||
void setProgram(GLuint program)
|
||||
{
|
||||
m_uniformStateCache.saveCurrentProgram(program);
|
||||
GL_CHECK(glUseProgram(program) );
|
||||
@ -4245,7 +4245,7 @@ namespace bgfx { namespace gl
|
||||
|
||||
// Cache uniform uploads to avoid redundant uploading of state that is
|
||||
// already set to a shader program
|
||||
void GlUniform1i(uint32_t loc, int value)
|
||||
void setUnifom1i(uint32_t loc, int value)
|
||||
{
|
||||
if (m_uniformStateCache.updateUniformCache(loc, value))
|
||||
{
|
||||
@ -4253,7 +4253,7 @@ namespace bgfx { namespace gl
|
||||
}
|
||||
}
|
||||
|
||||
void GlUniform1iv(uint32_t loc, int num, const int *data)
|
||||
void setUnifom1iv(uint32_t loc, int num, const int *data)
|
||||
{
|
||||
bool changed = false;
|
||||
for(int i = 0; i < num; ++i)
|
||||
@ -4269,7 +4269,7 @@ namespace bgfx { namespace gl
|
||||
}
|
||||
}
|
||||
|
||||
void GlUniform4f(uint32_t loc, float x, float y, float z, float w)
|
||||
void setUnifom4f(uint32_t loc, float x, float y, float z, float w)
|
||||
{
|
||||
UniformStateCache::f4 f; f.val[0] = x; f.val[1] = y; f.val[2] = z; f.val[3] = w;
|
||||
if (m_uniformStateCache.updateUniformCache(loc, f))
|
||||
@ -4278,7 +4278,7 @@ namespace bgfx { namespace gl
|
||||
}
|
||||
}
|
||||
|
||||
void GlUniform4fv(uint32_t loc, int num, const float *data)
|
||||
void setUnifom4fv(uint32_t loc, int num, const float *data)
|
||||
{
|
||||
bool changed = false;
|
||||
for(int i = 0; i < num; ++i)
|
||||
@ -4294,7 +4294,7 @@ namespace bgfx { namespace gl
|
||||
}
|
||||
}
|
||||
|
||||
void GlUniformMatrix3fv(uint32_t loc, int num, GLboolean transpose, const float *data)
|
||||
void setUnifomMatrix3fv(uint32_t loc, int num, GLboolean transpose, const float *data)
|
||||
{
|
||||
bool changed = false;
|
||||
for(int i = 0; i < num; ++i)
|
||||
@ -4310,7 +4310,7 @@ namespace bgfx { namespace gl
|
||||
}
|
||||
}
|
||||
|
||||
void GlUniformMatrix4fv(uint32_t loc, int num, GLboolean transpose, const float *data)
|
||||
void setUnifomMatrix4fv(uint32_t loc, int num, GLboolean transpose, const float *data)
|
||||
{
|
||||
bool changed = false;
|
||||
for(int i = 0; i < num; ++i)
|
||||
@ -4754,7 +4754,7 @@ namespace bgfx { namespace gl
|
||||
|
||||
if (0 != m_id)
|
||||
{
|
||||
s_renderGL->GlUseProgram(0);
|
||||
s_renderGL->setProgram(0);
|
||||
GL_CHECK(glDeleteProgram(m_id) );
|
||||
m_id = 0;
|
||||
}
|
||||
@ -7245,7 +7245,7 @@ namespace bgfx { namespace gl
|
||||
const RenderCompute& compute = renderItem.compute;
|
||||
|
||||
ProgramGL& program = m_program[key.m_program.idx];
|
||||
GlUseProgram(program.m_id);
|
||||
setProgram(program.m_id);
|
||||
|
||||
GLbitfield barrier = 0;
|
||||
for (uint32_t ii = 0; ii < maxComputeBindings; ++ii)
|
||||
@ -7743,7 +7743,7 @@ namespace bgfx { namespace gl
|
||||
// Skip rendering if program index is valid, but program is invalid.
|
||||
currentProgram = 0 == id ? ProgramHandle{kInvalidHandle} : currentProgram;
|
||||
|
||||
GlUseProgram(id);
|
||||
setProgram(id);
|
||||
programChanged =
|
||||
constantsChanged =
|
||||
bindAttribs = true;
|
||||
|
Loading…
Reference in New Issue
Block a user