class CommandBufferPipelineState

Defined at line 50 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.h

CommandBufferPipelineState is a helper class used by CommandBuffer to

encapsulate the subset of state that, when changed, requires a corresponding

change to the VkPipeline that is used.

Public Methods

void CommandBufferPipelineState (fxl::WeakPtr<PipelineBuilder> pipeline_builder)

Defined at line 63 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.cc

void ~CommandBufferPipelineState ()

Defined at line 67 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.cc

void BeginGraphicsOrComputeContext ()

Defined at line 69 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.cc

StaticState * static_state ()

Defined at line 76 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.h

const StaticState * static_state ()

Defined at line 77 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.h

vk::Pipeline FlushGraphicsPipeline (const PipelineLayout * layout, ShaderProgram * program, bool log_pipeline_creation)

Use |layout| and |program| to compute a hash that is used to look up the corresponding

vk::Pipeline. If no pipeline is found, then if |allow_build_pipeline| == true, a new pipeline

is lazily generated and cached for next time; otherwise a CHECK fails.

Defined at line 96 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.cc

vk::Pipeline FlushComputePipeline (const PipelineLayout * layout, ShaderProgram * program, bool log_pipeline_creation)

Unlike the |FlushGraphicsPipelineState| which hashes many attributes such as vertex bindings,

masks, blend states, etc, that only exist in graphics pipelines, this function computes a hash

just based off of the pipeline layout spec and the current static state. There isn't all that

much more that goes into compute pipelines, so this seems sufficient.

Defined at line 78 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.cc

PotentialStaticState * potential_static_state ()

Defined at line 80 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.h

const PotentialStaticState * potential_static_state ()

Defined at line 81 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.h

impl::RenderPass * render_pass ()

Defined at line 135 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.h

void set_render_pass (impl::RenderPass * render_pass)

Defined at line 136 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.h

uint32_t current_subpass ()

Defined at line 142 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.h

void reset_current_subpass ()

Defined at line 144 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.h

vk::Pipeline BuildGraphicsPipeline (const PipelineLayout * layout, ShaderProgram * program, bool log_pipeline_creation)

Helper function used by |FlushGraphicsPipeline()|, and by tests. Generates a new vk::Pipeline.

Defined at line 436 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.cc

vk::GraphicsPipelineCreateInfo * InitGraphicsPipelineCreateInfo (BlockAllocator * allocator, const PipelineLayout * layout, ShaderProgram * program)

Helper function used by |BuildGraphicsPipeline()|, and by tests. Uses |allocator| to allocate

a new vk::GraphicsPipelineCreateInfo, as well as other Vulkan structs pointed by it.

Defined at line 312 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.cc

void SetVertexAttributes (uint32_t binding, uint32_t attrib, vk::Format format, uint32_t offset)

Called by CommandBuffer::SetVertexAttributes().

Defined at line 468 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.cc

bool BindVertices (uint32_t binding, vk::Buffer buffer, vk::DeviceSize offset, vk::DeviceSize stride, vk::VertexInputRate step_rate)

Called by CommandBuffer::BindVertices(). Return true if pipeline change is

required.

Defined at line 481 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.cc

void FlushVertexBuffers (vk::CommandBuffer cb)

Called by CommandBuffer::FlushRenderState(). Binds any vertex buffers that

are both dirty and active in the current pipeline layout.

Defined at line 500 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.cc

void SetToDefaultState (DefaultState state)

Defined at line 516 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.cc

void IncrementSubpass ()

Called by CommandBuffer::NextSubpass().

Defined at line 563 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.cc

void SetDepthTestAndWrite (bool depth_test, bool depth_write)

Static state setters; these match the setters on CommandBuffer.

Defined at line 392 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.h

void SetWireframe (bool wireframe)

Defined at line 397 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.h

void SetDepthCompareOp (vk::CompareOp depth_compare)

Defined at line 401 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.h

void SetBlendEnable (bool blend_enable)

Defined at line 405 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.h

void SetBlendFactors (vk::BlendFactor src_color_blend, vk::BlendFactor src_alpha_blend, vk::BlendFactor dst_color_blend, vk::BlendFactor dst_alpha_blend)

Defined at line 409 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.h

void SetBlendFactors (vk::BlendFactor src_blend, vk::BlendFactor dst_blend)

Defined at line 419 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.h

void SetBlendOp (vk::BlendOp color_blend_op, vk::BlendOp alpha_blend_op)

Defined at line 424 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.h

void SetBlendOp (vk::BlendOp blend_op)

Defined at line 430 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.h

void SetColorWriteMask (uint32_t color_write_mask)

Defined at line 434 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.h

void SetDepthBias (bool depth_bias_enable)

Defined at line 438 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.h

void SetStencilTest (bool stencil_test)

Defined at line 442 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.h

void SetStencilFrontOps (vk::CompareOp stencil_front_compare_op, vk::StencilOp stencil_front_pass, vk::StencilOp stencil_front_fail, vk::StencilOp stencil_front_depth_fail)

Defined at line 446 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.h

void SetStencilBackOps (vk::CompareOp stencil_back_compare_op, vk::StencilOp stencil_back_pass, vk::StencilOp stencil_back_fail, vk::StencilOp stencil_back_depth_fail)

Defined at line 456 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.h

void SetStencilOps (vk::CompareOp stencil_compare_op, vk::StencilOp stencil_pass, vk::StencilOp stencil_fail, vk::StencilOp stencil_depth_fail)

Defined at line 466 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.h

void SetPrimitiveTopology (vk::PrimitiveTopology primitive_topology)

Defined at line 474 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.h

void SetPrimitiveRestart (bool primitive_restart)

Defined at line 479 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.h

void SetMultisampleState (bool alpha_to_coverage, bool alpha_to_one, bool sample_shading)

Defined at line 483 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.h

void SetFrontFace (vk::FrontFace front_face)

Defined at line 491 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.h

void SetCullMode (vk::CullModeFlags cull_mode)

Defined at line 495 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.h

unsigned int UnpackEnum (vk::CompareOp val)

Helper for unpacking Vulkan enums into an unsigned which can be stored in a StaticState field,

ensuring that it will fit in the alloted number of bits is not exceeded. For example,

VK_BLEND_OP_HARDLIGHT_EXT is 1000148019, which will not fit in kNumBlendOpBits == 3. If

such values become necessary in the future; this design will need to be revisited.

Defined at line 381 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.h

unsigned int UnpackEnum (vk::StencilOp val)

Defined at line 382 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.h

unsigned int UnpackEnum (vk::BlendFactor val)

Defined at line 383 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.h

unsigned int UnpackEnum (vk::BlendOp val)

Defined at line 384 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.h

unsigned int UnpackEnum (vk::FrontFace val)

Defined at line 385 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.h

unsigned int UnpackEnum (vk::PrimitiveTopology val)

Defined at line 386 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.h

unsigned int UnpackEnum (vk::CullModeFlags val)

These are not enums, but this name allows CommandBuffer's SET_STATIC_STATE_ENUM macro to work.

Defined at line 387 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.h

Enumerations

enum DefaultState
Name Value
kOpaque 0
kPremultipliedAlpha 1
kStraightAlpha 2
kWireframe 3

Convenient way to bring CommandBuffer to a known default state. See the

implementation of SetToDefaultState() for more details; it's basically a

big switch statement.

Defined at line 98 of file ../../src/ui/lib/escher/third_party/granite/vk/command_buffer_pipeline_state.h

Records

Friends

class VulkanTester