Topic/drawable 2 (#1032)
More vertex attribute work Move drawables above existing layer rendering. Use context for the actual draw call. Fake the vertexes in the shader to get something actually showing up. Simplify shader state management
This commit is contained in:
committed by
Bart Louwers
parent
e2bc75289c
commit
aceb0394ba
@@ -448,12 +448,23 @@ void Context::setDirtyState() {
|
||||
}
|
||||
|
||||
void Context::setupDraw(const gfx::Drawable& drawable) {
|
||||
if (auto &shader = drawable.getShader()) {
|
||||
if (shader != currentShader) {
|
||||
setCurrentShader(shader);
|
||||
if (const auto &shader = drawable.getShader()) {
|
||||
const auto& shaderGL = static_cast<const ShaderProgramGL&>(*shader);
|
||||
if (shaderGL.getGLProgramID() != program.getCurrentValue()) {
|
||||
program = shaderGL.getGLProgramID();
|
||||
}
|
||||
} else if (program != value::Program::Default) {
|
||||
program = value::Program::Default;
|
||||
}
|
||||
|
||||
// setDepthMode(depthMode);
|
||||
// setStencilMode(stencilMode);
|
||||
// setColorMode(colorMode);
|
||||
// setCullFaceMode(cullFaceMode);
|
||||
|
||||
// uniformStates.bind(uniformValues);
|
||||
// textureStates.bind(context, textureBindings);
|
||||
|
||||
auto& drawableGL = static_cast<const DrawableGL&>(drawable);
|
||||
auto& vao = drawableGL.getVertexArray();
|
||||
if (vao.isValid()) {
|
||||
@@ -463,15 +474,6 @@ void Context::setupDraw(const gfx::Drawable& drawable) {
|
||||
}
|
||||
}
|
||||
|
||||
void Context::setCurrentShader(gfx::ShaderProgramBasePtr value) {
|
||||
if ((currentShader = std::move(value))) {
|
||||
auto& shaderGL = static_cast<ShaderProgramGL&>(*currentShader);
|
||||
this->program = shaderGL.getGLProgramID();
|
||||
} else {
|
||||
this->program = value::Program::Default;
|
||||
}
|
||||
}
|
||||
|
||||
void Context::clear(std::optional<mbgl::Color> color,
|
||||
std::optional<float> depth,
|
||||
std::optional<int32_t> stencil) {
|
||||
|
||||
Reference in New Issue
Block a user