Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
mesa
mesa
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 2,431
    • Issues 2,431
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 665
    • Merge Requests 665
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Mesa
  • mesamesa
  • Issues
  • #797

Closed
Open
Created Sep 18, 2019 by Bugzilla Migration User@bugzilla-migration

Mesa could optimize repeated multiplication of a varying by a constant factor in the fragment shader

Submitted by Samuel Rødal

Assigned to Ian Romanick

Link to original bug (#55153)

Description

When the fragment shader contains code like this:

varying vec4 pos;

void main(void){ const float factor=0.1;

vec3 nf1=texture2D( tex2, pos.xyfactor).xyz; vec3 nf2=texture2D( tex2, pos.xzfactor).xyz; vec3 nf3=texture2D( tex2, pos.zy*factor).xyz;

... }

and this is the only use of pos in the fragment shader, it's more optimal to multiply the pos varying by 0.1 in the vertex shader. This gives a noticeable performance improvement at least on r600.

Is this something that could be automatically done by the GLSL compiler / optimizer?

Version: 8.0

Blocking

  • Bug 77547
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None