Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
  • This project
    • Loading...
  • Sign in / Register
S
swiftshader
  • Project
    • Overview
    • Details
    • Activity
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 0
    • Issues 0
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Chen Yisong
  • swiftshader
  • Repository

Switch branch/tag
  • swiftshader
  • src
  • Device
  • Context.hpp
Find file
BlameHistoryPermalink
  • Nicolas Capens's avatar
    Value-initialize all vk::GraphicsState members · 940f2acc
    Nicolas Capens authored Feb 20, 2021
    The vk::GraphicsState constructor does not initialize all members in all
    code paths. We were relying on the zero-initializing done by
    vk::allocate() which is used to allocate vk::GraphicsPipeline which in
    turn contains a GraphicsState member.
    
    We want to change vk::allocate() to no longer zero-initialize all
    memory, to catch more MemorySanitizer errors made by applications. Thus
    we must also not rely on such automatic initialization ourselves.
    
    Note that this change might also hide MemorySantizer violations
    committed by the application side. For example some state is only copied
    from VkGraphicsPipelineCreateInfo into vk::GraphicsState on construction
    when flags indicate they're not dynamic state. If the application
    forgets to makerecord commands that set the dynamic state, their value
    is undefined:
    
    Vulkan 1.2.178 section 6. Command Buffers:
    "When a command buffer begins recording, all state in that command
    buffer is undefined."
    
    Vulkan 1.2.178 section 10.11. Dynamic State:
    "If the state is specified as dynamic in the new pipeline object, then
    that command buffer state is not disturbed. Before any draw or dispatch
    call with this pipeline there must have been at least one call to each
    of the corresponding dynamic state setting commands since the command
    buffer recording was begun, or the last bound pipeline object with that
    state specified as static, whichever was the latter."
    
    Thus once sw::allocate() no longer also zeroes this data, we should
    revert the value-initialization where possible and ensure we don't
    touch the uninitialized data ourselves, unless as a consequence of an
    application bug.
    
    Bug: b/140991626
    Change-Id: I060e8d8a79e93b0676669eed361fab4f86ab1b56
    Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/53089
    Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
    Kokoro-Result: kokoro <noreply+kokoro@google.com>
    Tested-by: 's avatarNicolas Capens <nicolascapens@google.com>
    Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com>
    940f2acc
Context.hpp 9.17 KB
EditWeb IDE
×

Replace Context.hpp

Attach a file by drag & drop or click to upload


Cancel
A new branch will be created in your fork and a new merge request will be started.