GPU Codegen parser warning #111353

Open
opened 2023-08-21 18:06:42 +02:00 by Charlie Jolly · 3 comments
Member

I'm working on a patch for Gabor Noise: #110802

@OmarEmaraDev suggested opening a bug report.

The function below has to be written with a return type rather than void.

Using void generates the following gpu_codegen parser warning. Unknown parameter type "GaborParams"

void gabor_sample(
    GaborParams gp, float orand, float orand2, float prand, out vec3 omega, out float phi)

As a workaround I have written the function with a return type of GaborParams which solves the issue.

GaborParams is a struct of floats.

GaborParams gabor_sample(
    GaborParams gp, float orand, float orand2, float prand, out vec3 omega, out float phi)
{
  float pvar = mix(0.0, prand * 2.0 - 1.0, gp.phase_variance);
  phi = M_2PI * pvar + gp.phase;

  /* Anisotropic direction. */
  if (gp.anisotropic == 1) {
    omega = gp.direction;
  }
  else { /* Isotropic. */
    float ovar = M_PI * (orand * 2.0 - 1.0);
    float omega_t = ovar * gp.rot_variance - gp.rotation;
    float cos_omega_p = 1.0 - 2.0 * orand2;
    float sin_omega_p = sqrt(1.0 - cos_omega_p * cos_omega_p);
    float sin_omega_t = sin(omega_t);
    float cos_omega_t = cos(omega_t);
    omega = normalize(vec3(cos_omega_t * sin_omega_p, sin_omega_t * sin_omega_p, cos_omega_p));
  }
  /* Return GaborParams to workaround gpu_codegen parser warning when return type is set to void :
   * Unknown parameter type "GaborParams". */
  return gp;
}
I'm working on a patch for Gabor Noise: https://projects.blender.org/blender/blender/pulls/110802 @OmarEmaraDev suggested opening a bug report. The function below has to be written with a return type rather than void. Using `void` generates the following gpu_codegen parser warning. `Unknown parameter type "GaborParams"` ``` void gabor_sample( GaborParams gp, float orand, float orand2, float prand, out vec3 omega, out float phi) ``` As a workaround I have written the function with a return type of `GaborParams` which solves the issue. `GaborParams` is a struct of floats. ``` GaborParams gabor_sample( GaborParams gp, float orand, float orand2, float prand, out vec3 omega, out float phi) { float pvar = mix(0.0, prand * 2.0 - 1.0, gp.phase_variance); phi = M_2PI * pvar + gp.phase; /* Anisotropic direction. */ if (gp.anisotropic == 1) { omega = gp.direction; } else { /* Isotropic. */ float ovar = M_PI * (orand * 2.0 - 1.0); float omega_t = ovar * gp.rot_variance - gp.rotation; float cos_omega_p = 1.0 - 2.0 * orand2; float sin_omega_p = sqrt(1.0 - cos_omega_p * cos_omega_p); float sin_omega_t = sin(omega_t); float cos_omega_t = cos(omega_t); omega = normalize(vec3(cos_omega_t * sin_omega_p, sin_omega_t * sin_omega_p, cos_omega_p)); } /* Return GaborParams to workaround gpu_codegen parser warning when return type is set to void : * Unknown parameter type "GaborParams". */ return gp; } ```
Charlie Jolly added the
Type
Report
Priority
Normal
Status
Needs Triage
labels 2023-08-21 18:06:42 +02:00
Clément Foucault was assigned by Charlie Jolly 2023-08-21 18:06:43 +02:00

This is a problem in our codegen parsing code. Every function with void return type it parsed as potential GPUFunction.

This could be fixed by using a custom keyword as return type to tag functions to be parsed as GPUFunction.

This is a problem in our codegen parsing code. Every function with `void` return type it parsed as potential `GPUFunction`. This could be fixed by using a custom keyword as return type to tag functions to be parsed as `GPUFunction`.
Clément Foucault removed their assignment 2023-08-21 18:41:02 +02:00

This is a problem in our codegen parsing code. (...)

Seems a known issue then? So I'll confirm the report and set it as Known Issue.

However this issue seems to qualify as a build issue. And build issues are off-topic on the bug tracker as explained by the submission form.

First time reporting? See tips.

In these cases we recommend asking on blender.chat or DevTalk.

> This is a problem in our codegen parsing code. (...) Seems a known issue then? So I'll confirm the report and set it as `Known Issue`. However this issue seems to qualify as a build issue. And build issues are off-topic on the bug tracker as explained by the [submission form](https://projects.blender.org/blender/blender/issues/new?template=.gitea%2fissue_template%2fbug.yaml). > **First time reporting? See tips.** > - For feature requests, feedback, questions or issues building Blender, see [communication channels](https://wiki.blender.org/wiki/Communication/Contact#User_Feedback_and_Requests). In these cases we recommend asking on [blender.chat](https://blender.chat/channel/blender-coders) or [DevTalk](https://devtalk.blender.org/c/blender).

@CharlieJolly as code quality goes, you could return a GaborSample from the function.

@CharlieJolly as code quality goes, you could return a `GaborSample` from the function.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#111353
No description provided.