Text Editor: Add GLSL support language #116793
No reviewers
Labels
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
6 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#116793
Loading…
Reference in New Issue
No description provided.
Delete Branch "Gangneron/blender:Add_GLSL"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Pr adds the GLSL language to the text editor.
The objective is to be able to create your own GLSL shaders in blender. This improves the workflow since all shader programming can be done directly in Blender. In addition, the GLSL language is a very popular language in the video games industry and even in general.
The goal is then to also support HSLS in the same way in order to have a complete solution with OSL, GLSL and HLSL
If there are any key words or other missing words, tell me
I use GLSL 4.3 doc.
I use GLSL 4.3 for corresponding to OpenGL version
@ideasman42
@ -0,0 +49,4 @@
"mat4"
"out"
"return"
"sampler1D"
You are missing a lot of sampler types.
(u|i)sampler((1|2|3)D|Cube|Buffer)(Array)(Shadow)
is the pattern of all possible types.Edit: forgot shadow sampler and buffer sampler.
ok thank you, but when I look at the file for osl there are a lot fewer elements so I ask myself a question: either I put too many elements or some are missing in the file for osl
i update list of keyword
@fclem i update Pr and i add what you normally asked me
Could you tell me if there are still missing keywords or if some are not placed in the right category. Likewise, the Built-In var must be in a dedicated function called builtinvar for example ?
Thank you for your response and review.
@ -0,0 +24,4 @@
static int textformat_glsl_literals_builtinfunc_data[]
{
"Array"
I don't know what this
Array
is. And why is it with uppercaseA
?@ -0,0 +115,4 @@
"volatile"
"while"
"#define"
"#defined"
I don't know how to handle that, but preprocessor directive can be nested and not glued to the
#
symbol. That's the usual usecase fordefined
.i fix problem but maybe I could put that in the text_format_glsl_find_preprocessor function
@ideasman42 what do you think of my idea of creating a function?
@ -0,0 +167,4 @@
"dFdy"
"distance"
"dot"
"dxdx"
I don't think this exists. Same goes for the
dxdy
,dydx
anddydy
.@ -0,0 +192,4 @@
"greaterThan"
"greaterThanEqual"
"groupMemoryBarrier"
"idexp"
It's
ldexp
notidexp
. If you did this list by hand, other typos might have slept in. So i would suggest to not do manually and use an official list somewhere like https://docs.gl/sl4/acos (left panel, expand all sections).@ -0,0 +390,4 @@
if (txtfmt_glsl_find_specialvar(str) != -1) {fmt = FMT_TYPE_SPECIAL;}
else if (txtfmt_glsl_find_builtfunc(str) != -1) {fmt = FMT_TYPE_KEYWORD;}
You should run
make format
to avoid any custom formatting issues.This block is copy pasted from an area which uses
/* clang-format off */
. So either drop the special formatting or make sure it is correctly formatted and add back the/* clang-format off */
. Same goes for the other occurrence of this part.Ok thanks you but i work with endline on LF
Requesting minor changes.
@ -0,0 +19,4 @@
#include "text_format.hh"
/*---------------------------------------------------------------------*/
Use doxy-sections, https://developer.blender.org/docs/handbook/guidelines/c_cpp/#comment-sections
@ -0,0 +288,4 @@
/*Add in futur verion when GLSL 4.5 support in Blender*/
/*"textureSamples"*/
/*Built-In Variable */
Use spaces within C-style comments, e.g.
/* Built-In Variable */
normally all comment problems are corrected
@ -0,0 +548,4 @@
str++;
}
/* Terminate and add continuation char */
End comments with full-stops.
There are quite a few errors in the code, it seems like the PR in it's current form can't have been compiled/tested.
@ -0,0 +10,4 @@
/*"include <cstring> can be replace by import std:string;"*/
#include "BLI_blendlib.h"
This header doesn't exist.
@ -0,0 +23,4 @@
/* Define all keywords who can use
*/
static int textformat_glsl_literals_builtinfunc_data[] = {
Wrong type.
@ -0,0 +392,4 @@
} else if (txtfmt_glsl_find_builtfunc(str) != -1) {fmt = FMT_TYPE_KEYWORD;
} else if (txtfmt_glsl_find_reserved(str) != -1) {fmt = FMT_TYPE_RESERVED;
} else if (txtfmt_glsl_find_preprocessor(str) != -1) {fmt = FMT_TYPE_DIRECTIVE;
} else {fmt = FMT_TYPE_DEFAULT;
Missing closing brace.
@ -0,0 +406,4 @@
FlattenString fs;
const char *str;
char *fmt;
char cont_orig, cont, find, prev = '';
empty character constant
I don't see what I need to change
c'est un code identique à text_format_osl
What is the value of prev expected to be? Two single quotes without spaces doesn't define a character. OSL for example sets
prev = ' '
.@ -0,0 +526,4 @@
/* keep in sync with `txtfmt_glsl_format_identifier()`. */
if ((i = txtfmt_glsl_find_specialvar(str)) != -1) {prev = FMT_TYPE_SPECIAL;
}else if ((i = txtfmt_glsl_find_builtinfunc(str)) != -1) {prev = FMT_TYPE_KEYWORD;
Function doesn't exist.
This patch doesn't compile on GCC, clang-format has also not been applied.
Errors include:
@Gangneron are you compiling & testing these changes?
The latest updates still fail making it seem this PR can't have even been tested.
I don't understand where most of the errors come from knowing that part of the code comes directly from the OSL file. do you have an explanation for this? Furthermore, certain completely external files seem to pose a problem on this patch but not on the others even though they are up to date.
i can't compile because the CMAKE file of datadoc have a error an error although I have not modified it
@blender-bot build-branch branch
Only blender organization members with write access can start builds. See documentation for details.
@ideasman42 can you use blender-bot build-branch branch please for i want view errors of build
@Gangneron what is the environment your using to develop the patch?
Please make sure the patch builds without introducing new warnings/errors on this environment.
i use visual studio community or visual studio code.
Bur if i compile Blender project i have one error of datadoc CMAKE File after compile so i can't compile.
This is why I would like you to ask blender boot to report its error to me. Because certain errors mentioned above are not possible given that the other files which are called have no problem even though the code is identical.
Having to get someone else to run the buildbot for you isn't a practical way to do development,
please investigate the cause of compiling to fail.
You can ask for help here:
#blender-builds
room inblender.chat
.Marking as WIP until the patch is updated & tested to compile.
Text Editor: Add GLSL support languageto WIP: Text Editor: Add GLSL support language1d41434bb2
this is working in the upbge fork
any text named .glsl in the editor is hinted I think*
@ideasman42 normally it's good, I didn't find any errors.
In any case if there are errors in my file there are also some in text_format_osl.cc
This branch isn't compiling & the patch now includes many unrelated changes.
Okay I'm going to remove these changes. However, I didn't quite understand the beginning of your message.
I delete during the day the files that should be deleted from this PR
And after normally will be good for fusion
edit not syntax errors but the patch fails to compile.
There are various
syntaxerrors still.Please only request review once you have compiled this patch locally and tested it to work.
i don't undrstand error. question do you have the same problem when you compile text_format_osl.cc?
when I want to compile I have errors on CMAKE files not modified or not the line in question
the syntax is identique a text_format_osl.cc
If you have errors compiling, this needs to be addressed before further development.
okay but it's files not modified and extern of PR
strange because the code is logically identical to that of the osl language
when you write GLSL script can you execute the code ?
I am open to suggestions for change if you have any.
@ideasman42 every problem fix. of my part the code is good.
This is still the case, what compiler are you using? can you confirm this compiles for you without warnings?
If this is ready for review, please remove the "WIP:" prefix from the title, as that indicates "do not review this yet, it is still work in progress".
Yeah, upbge has a 2d filter system that can run in post vs each frame, we can also use gpu module to run custom glsl.
For now, I'm going to test the custom GLSL script compilation integration. But you have to check the file compilation
after reflexion i go create new Pr for implement of custom GLSL script compile
WIP: Text Editor: Add GLSL support languageto Text Editor: Add GLSL support language@dr.sybren can you review code please.
@ -0,0 +241,4 @@
"texelFetchOffset"
"texture"
"texture1D"
"texture1DLod"
These
texture*Lod
keywords doesn't exist. OnlytextureLod
is valid.i delete keywords
Text Editor: Add GLSL support languageto WIP: Text Editor: Add GLSL support language@Gangneron please confirm you are actually compiling and testing this PR, resolving warnings and checking it works as expected.
Once this is done, remove the WIP prefix and it can be reviewed.
I made it compile and fixed the few issues that were remaining. This should be good to go now.
WIP: Text Editor: Add GLSL support languageto Text Editor: Add GLSL support language@fclem Thank you very much for fix problems of compile
But I have questions. How indicate preprocessing instructions?
I would say keeping only the first keyword highlighted is enough and improves readability. That's what OSL does too.
Ok
So I tag ideasman42 for relect ?
You can, but I think he will see it anyway.
I just need to fix the
else
clauses not being properly highlighted. But for me that's fine to land already.Sorry if I don't Sorry if I couldn't resolve the issues myself. Thanks a lot for your help.
For add the GLSL compile i would do the research for know how do before create a Pr
Ah the keyword table is still not sorted appropriately. Let me figure out.
Else I can seen tomorrow
@Gangneron Just so you know for next time, don't use the PR as general conversation channel. If you want to coordinate work with other developpers, use https://blender.chat/channel/blender-coders . The PR is usually made to discuss the technical details. Otherwise the PR gets noisy and it's difficult for reviewers to find the relevant information.
@fclem thanks for the fixes, committed
462c144f41
with one functional change:Otherwise toggling comments would insert
/**/
before the text without commenting it.@ideasman42 can I perform the merge?
This has been committed to main,
462c144f41
Ok thank you. Today i add compilation system in new Pr and i ask how to modify the documentation and the release note.
Added to release notes: blender/blender-developer-docs@8b6d9a3dc3.
Pull request closed