{
const PipelineState &self = *static_cast<const PipelineState *>(this);
Device &device = Device::get_current();
- unsigned mask = changes;
if(applied_to && applied_to!=&device)
{
applied_to->get_state().last_pipeline = 0;
- mask = ~0U;
+ changes = ~0U;
}
OpenGLDeviceState &dev_state = device.get_state();
{
if(dev_state.last_pipeline)
dev_state.last_pipeline->applied_to = 0;
- mask = ~0U;
+ changes = ~0U;
}
- if(mask&PipelineState::FRAMEBUFFER)
+ if(changes&PipelineState::FRAMEBUFFER)
{
const Framebuffer *framebuffer = self.framebuffer;
glBindFramebuffer(GL_FRAMEBUFFER, framebuffer ? framebuffer->id : 0);
}
}
- if(mask&(PipelineState::VIEWPORT|PipelineState::SCISSOR|PipelineState::FRAMEBUFFER))
+ if(changes&(PipelineState::VIEWPORT|PipelineState::SCISSOR|PipelineState::FRAMEBUFFER))
if(const Framebuffer *framebuffer = self.framebuffer)
{
Rect fb_rect = framebuffer->get_rect();
- if(mask&(PipelineState::VIEWPORT|PipelineState::FRAMEBUFFER))
+ if(changes&(PipelineState::VIEWPORT|PipelineState::FRAMEBUFFER))
{
Rect viewport = fb_rect.intersect(self.viewport);
glViewport(viewport.left, viewport.bottom, viewport.width, viewport.height);
}
- if(mask&(PipelineState::SCISSOR|PipelineState::FRAMEBUFFER))
+ if(changes&(PipelineState::SCISSOR|PipelineState::FRAMEBUFFER))
{
Rect scissor = fb_rect.intersect(self.scissor);
if(scissor!=fb_rect)
}
}
- if(mask&PipelineState::SHPROG)
+ if(changes&PipelineState::SHPROG)
{
glUseProgram(self.shprog ? self.shprog->id : 0);
}
}
- if(mask&PipelineState::UNIFORMS)
+ if(changes&PipelineState::UNIFORMS)
{
for(const PipelineState::BoundUniformBlock &u: self.uniform_blocks)
- if(u.changed || mask==~0U)
+ if(u.changed || changes==~0U)
{
if(u.used)
{
}
}
- if(mask&PipelineState::TEXTURES)
+ if(changes&PipelineState::TEXTURES)
{
for(const PipelineState::BoundTexture &t: self.textures)
- if(t.changed || mask==~0U)
+ if(t.changed || changes==~0U)
{
if(t.used)
{
}
}
- if(mask&PipelineState::VERTEX_SETUP)
+ if(changes&PipelineState::VERTEX_SETUP)
{
const VertexSetup *vertex_setup = self.vertex_setup;
glBindVertexArray(vertex_setup ? vertex_setup->id : 0);
}
}
- if(mask&PipelineState::FACE_CULL)
+ if(changes&PipelineState::FACE_CULL)
{
glFrontFace(self.front_face==CLOCKWISE ? GL_CW : GL_CCW);
glDisable(GL_CULL_FACE);
}
- if(mask&PipelineState::DEPTH_TEST)
+ if(changes&PipelineState::DEPTH_TEST)
{
const DepthTest &depth_test = self.depth_test;
if(depth_test.enabled)
glDepthMask(depth_test.write);
}
- if(mask&PipelineState::STENCIL_TEST)
+ if(changes&PipelineState::STENCIL_TEST)
{
const StencilTest &stencil_test = self.stencil_test;
if(stencil_test.enabled)
glDisable(GL_STENCIL_TEST);
}
- if(mask&PipelineState::BLEND)
+ if(changes&PipelineState::BLEND)
{
const Blend &blend = self.blend;
if(blend.enabled)
{
const PipelineState &self = *static_cast<const PipelineState *>(this);
- if(self.changes&PipelineState::VERTEX_SETUP)
+ if(changes&PipelineState::VERTEX_SETUP)
self.vertex_setup->refresh();
constexpr unsigned pipeline_mask = PipelineState::SHPROG|PipelineState::VERTEX_SETUP|PipelineState::FACE_CULL|
PipelineState::DEPTH_TEST|PipelineState::STENCIL_TEST|PipelineState::BLEND|PipelineState::PRIMITIVE_TYPE;
- if(self.changes&pipeline_mask)
+ if(changes&pipeline_mask)
handle = device.get_pipeline_cache().get_pipeline(self);
- if(self.changes&(PipelineState::SHPROG|PipelineState::UNIFORMS|PipelineState::TEXTURES))
+ if(changes&(PipelineState::SHPROG|PipelineState::UNIFORMS|PipelineState::TEXTURES))
{
- unsigned changed_sets = (self.changes&PipelineState::SHPROG ? ~0U : 0U);
+ unsigned changed_sets = (changes&PipelineState::SHPROG ? ~0U : 0U);
for(const PipelineState::BoundUniformBlock &u: self.uniform_blocks)
if(u.changed || changed_sets==~0U)
{
descriptor_set_handles[i] = device.get_pipeline_cache().get_descriptor_set(self, i);
}
- self.changes = 0;
+ changes = 0;
}
uint64_t VulkanPipelineState::compute_hash() const