Skip to content

Disallow DVLE-Specific Directives When Using .nodvle #32

Description

@Wyatt-James

Bug Report

What's the issue you encountered?

Certain directives perform no function, or worse, enable undefined behavior when used with the .nodvle directive. A compilation error should be raised in these circumstances.

Affected directives include:

  • all .const directives
  • all .set directives
  • .entry

How can the issue be reproduced?

Compile a group of shader files, with at least one file containing the .nodvle directive and one or more of the aforementioned directives. This program will compile normally.

Environment?

  • What host OS are you using?
    • Win10 x64 with Ubuntu LTS 18.04 under WSL2
  • Official release or unofficial/self-compiled build:
    • Official Release

Additional context?

According to the README, constants are never shared between DVLEs. Despite this, they can be declared inside of shader source files containing the .nodvle directive. These constants will not have a defined value, as constants are only ever initialized when a DVLE is selected, thus causing undefined behavior that can be very difficult to trace if a developer is unfamiliar with their function.

The same applies to the .set directives, which are also only ever executed in files with DVLEs.

The .entry directive, while harmless, has no function within a .nodvle file.

Activity

  1. fincs commented on Jul 26, 2024

    @fincs
    Member

    This is a good point. However, I think it would be more intuitive to add a way to actually instantiate these constants in all dvles that make use of procedures contained in the non-dvle pica source code file.

  2. Wyatt-James commented on Jul 27, 2024

    @Wyatt-James
    Author

    It would be convenient for sure, but performance on shader swaps would be slightly worse than using shared uniforms.

    Actually, that's true for any constant, is it not? At least under C3D, since I believe it re-sends all constants on a shader load.

  3. fincs commented on Jul 27, 2024

    @fincs
    Member

    There usually aren't that many constants per DVLE. Rewriting shader code memory (when using shaders from different shbins) is much more expensive. I'd say it's not really a concern.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions