Git Product home page Git Product logo

glsl4idea's People

Contributors

abigailbuccaneer avatar darkyenus avatar davidgilbertson avatar jameshiew avatar marcoaaguiar avatar ra4king avatar tasemo avatar wyozi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

glsl4idea's Issues

Geometry shader syntax error

The semicolon errors with "Expected a type specifier."

layout(points) in;
layout(line_strip, max_vertices = 6) out;

Precision markers are not higlighted correctly.

In version 1.7 on CLion 1.0.1, the following code snippet:

#ifdef GL_ES
precision mediump float;
precision mediump vec2;
precision mediump vec4;
precision mediump sampler2D;
#endif // GL_ES

gets improperly highlighted for vec2 and vec4, as per the attached screenshot.
screen shot 2015-05-05 at 12 11 16

I suspect this happens on more types, but I didn't do any further tests. Adding precision markers to vec2/vec4 types seems to be legal according to section 4.5.2 of the specifications.

Convert Vector Components does not work

Example:

    vec2 a = vec2(1.0).xy;
  • Cursor on xy
  • Alt-Enter - Convert Vector Components

Result:

java.lang.ClassCastException: com.intellij.psi.impl.source.tree.LeafPsiElement cannot be cast to glslplugin.lang.elements.GLSLIdentifier
    at glslplugin.intentions.vectorcomponents.VectorComponentsIntention$1$1.run(VectorComponentsIntention.java:84)
    at com.intellij.openapi.application.RunResult.run(RunResult.java:38)
    at com.intellij.openapi.command.WriteCommandAction$2$1.run(WriteCommandAction.java:114)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:937)
    at com.intellij.openapi.command.WriteCommandAction$2.run(WriteCommandAction.java:111)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:124)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:99)
    at com.intellij.openapi.command.WriteCommandAction.performWriteCommandAction(WriteCommandAction.java:108)
    at com.intellij.openapi.command.WriteCommandAction.execute(WriteCommandAction.java:80)
    at glslplugin.intentions.vectorcomponents.VectorComponentsIntention$1.run(VectorComponentsIntention.java:87)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:715)
    at java.awt.EventQueue.access$400(EventQueue.java:82)
    at java.awt.EventQueue$2.run(EventQueue.java:676)
    at java.awt.EventQueue$2.run(EventQueue.java:674)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:685)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:734)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:569)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:382)

Unable to rebuild the plugin using CLion's Platform SDK

As per subject, I've tried to rebuild the plugin from source following the given instructions, but it seems like CLion's Platform SDK is missing a few things that this plugin needs.

Here's the compilation report (with the latest version from the repo):

glsl4idea/src/glslplugin/components/GLSLCompiler.java
Error:(24, 37) java: package com.intellij.openapi.compiler does not exist
Error:(25, 37) java: package com.intellij.openapi.compiler does not exist
Error:(26, 37) java: package com.intellij.openapi.compiler does not exist
Error:(27, 37) java: package com.intellij.openapi.compiler does not exist
Error:(39, 38) java: cannot find symbol
  symbol: class TranslatingCompiler
Error:(46, 42) java: cannot find symbol
  symbol:   class CompileScope
  location: class glslplugin.components.GLSLCompiler
Error:(52, 62) java: cannot find symbol
  symbol:   class CompileContext
  location: class glslplugin.components.GLSLCompiler
Error:(57, 25) java: cannot find symbol
  symbol:   class CompileContext
  location: class glslplugin.components.GLSLCompiler
Error:(57, 97) java: cannot find symbol
  symbol:   class OutputSink
  location: class glslplugin.components.GLSLCompiler
Error:(86, 42) java: cannot find symbol
  symbol:   class OutputItem
  location: class glslplugin.components.GLSLCompiler
Error:(76, 16) java: cannot find symbol
  symbol:   class OutputItem
  location: class glslplugin.components.GLSLCompiler.ExitResult
Error:(107, 17) java: cannot find symbol
  symbol:   class CompileContext
  location: class glslplugin.components.GLSLCompiler.GLSLCompileAction
Error:(110, 34) java: cannot find symbol
  symbol:   class CompileContext
  location: class glslplugin.components.GLSLCompiler.GLSLCompileAction
Error:(45, 5) java: method does not override or implement a method from a supertype
Error:(51, 5) java: method does not override or implement a method from a supertype
Error:(56, 5) java: method does not override or implement a method from a supertype
Error:(78, 24) java: cannot find symbol
  symbol:   class OutputItem
  location: class glslplugin.components.GLSLCompiler.ExitResult
Error:(122, 36) java: cannot find symbol
  symbol:   variable CompilerMessageCategory
  location: class glslplugin.components.GLSLCompiler.GLSLCompileAction
glsl4idea/src/glslplugin/actions/GLSLDeduceExpressionTypeAction.java
Error:(24, 41) java: cannot find symbol
  symbol:   class DataKeys
  location: package com.intellij.openapi.actionSystem
Error:(33, 29) java: cannot find symbol
  symbol:   class PsiUtil
  location: package com.intellij.psi.util
Error:(80, 41) java: cannot find symbol
  symbol:   variable DataKeys
  location: class glslplugin.actions.GLSLDeduceExpressionTypeAction
Error:(119, 40) java: cannot find symbol
  symbol:   variable DataKeys
  location: class glslplugin.actions.GLSLDeduceExpressionTypeAction
Error:(120, 41) java: cannot find symbol
  symbol:   variable DataKeys
  location: class glslplugin.actions.GLSLDeduceExpressionTypeAction
Error:(129, 26) java: cannot find symbol
  symbol:   variable PsiUtil
  location: class glslplugin.actions.GLSLDeduceExpressionTypeAction
glsl4idea/src/glslplugin/structureview/GLSLStructureViewFactory.java
Error:(34, 52) java:  is not abstract and does not override abstract method createStructureViewModel(com.intellij.openapi.editor.Editor) in com.intellij.ide.structureView.TreeBasedStructureViewBuilder

I'll see if I can fix some of those, hopefully without breaking the plugin in IDEA.

Does custom structureview do anything?

Removing <lang.psiStructureViewFactory language="GLSL" implementationClass="glslplugin.structureview.GLSLStructureViewFactory"/> from plugin.xml doesn't seem to change anything, and that is the only entry point. What does it actually do then? Do we need it?

Files with errors should be shown in the project tree

If a Java file contains an error, then that file and its parent packages will have a red error squiggle in the project tree viewer (and on the breadcrumb menu at the top). This isn't the case for GLSL files. I can't find what needs to be implemented to do this.

Function calls are parsed as constructors

Function calls are seemingly all getting parsed as constructors, which means they're all doing type conversions to struct types which don't exist.

int f();

void main() {
    int x = f(); // error: can't assign 'f' to 'int'
    vec3 x = normalize(vec3(1.f)); // error: can't assign 'normalize' to 'vec3'
}

String literals should be lexed for ARB_shading_language_include

In our engine we use a preprocessor, which allows us to use #include "filename.glsl" in shaders. The syntax is the same as the ARB_shading_language_include extension.

In order for this extension (and, my real reason to suggest this, our codebase) to be supported in terms of tokens, it's necessary to lex string literals. This should be very easy as they contain no special characters or escaping. Parser support isn't required, as they're only valid in preprocessor directives which already just eat all the tokens until the end of the line.

Switch statements are not recognised

The parser makes no attempt to parse switch statements. They end up parsed as a function call, a missing semicolon and then a compound statement.

Relevant Piglit testcases:

fail/switch-case-duplicated.vert
fail/switch-case-empty-end.vert
fail/switch-case-in-int.vert
fail/switch-case-uniform-int.vert
fail/switch-default-duplicated.vert
fail/switch-expression-const-float.vert
fail/switch-expression-const-ivec2.vert
fail/switch-expression-const-vec2.vert
fail/switch-expression-in-float.vert
fail/switch-expression-in-vec2.vert
fail/switch-expression-uniform-float.vert
fail/switch-expression-uniform-vec2.vert
fail/switch-expression-var-float.vert
fail/switch-expression-var-vec2.vert
fail/switch.frag
fail/switch-nested-case.vert
fail/switch-nested-default.vert
fail/switch-uint-vs-int.vert
pass/switch-case-const-int-expression.vert
pass/switch-case-const-int.vert
pass/switch-case-fallthrough.vert
pass/switch-case-statement.vert
pass/switch-default.vert
pass/switch-expression-const-int.vert
pass/switch-expression-in-int.vert
pass/switch-expression-uniform-int.vert
pass/switch-expression-var-int.vert
pass/switch-nested-break.vert
pass/switch-nested-loop.vert
pass/switch-nested-switch.vert

{} style array initializers aren't recognized

While working with a 430 core comp shader I noticed a couple of incorrect syntax checks.

  • In the following line the space between image2d and framebuffer is marked with Expected '{'
    layout(binding = 0, rgba32f) uniform image2D framebuffer;
  • In the following snippet multiple errors are marked but the root cause is likely that { } style initializers are not recognized correctly.
const box boxes[] = {
  /* The ground */
  {vec3(-5.0, -0.1, -5.0), vec3(5.0, 0.0, 5.0)},
  /* Box in the middle */
  {vec3(-0.5, 0.0, -0.5), vec3(0.5, 1.0, 0.5)}
};

Samples from a recent LWJGL Ray trace tutorial.
Syntax validates with the Reference Compiler

The plugin is not yet available on https://plugins.jetbrains.com/

Are there any plans to upload the plugin to JetBrains' repository? Given that you got the official blessing from the original authors to carry over development I think the next logical step would be to upload an updated version. Not even JetBrains employees are aware of this version it seems, according to https://youtrack.jetbrains.com/issue/CPP-1536 - and there is definitely the request for such a thing, now that it works under CLion too. Now that more GLES functionalities are covered, I know for sure that I wouldn't mind having this available on Android Studio too :)

Modular extension support

#extension extension_name : enable
Load the corresponding environment file with types and mehods.

AppCode 3.1 fails to launch with GLSL plugin enabled

Using AppCode 3.1 (139.1402) and GLSL plugin 1.8 I receive the following error after enabling the GSLS plugin and re-starting AppCode:

Plugin 'GLSL' failed to initialize and will be disabled. Please restart AppCode.

java.lang.NoSuchMethodError: com.intellij.ide.fileTemplates.FileTemplateManager.getDefaultInstance()Lcom/intellij/ide/fileTemplates/FileTemplateManager;
    at glslplugin.components.GLSLTemplatesLoader.initComponent(GLSLTemplatesLoader.java:39)
    at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentConfigComponentAdapter$1.getComponentInstance(ComponentManagerImpl.java:567)
    at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentConfigComponentAdapter.getComponentInstance(ComponentManagerImpl.java:609)
    at com.intellij.util.pico.DefaultPicoContainer.getLocalInstance(DefaultPicoContainer.java:236)
    at com.intellij.util.pico.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:223)
    at com.intellij.util.pico.DefaultPicoContainer.getComponentInstance(DefaultPicoContainer.java:210)
    at org.picocontainer.alternatives.AbstractDelegatingMutablePicoContainer.getComponentInstance(AbstractDelegatingMutablePicoContainer.java:75)
    at com.intellij.openapi.components.impl.ComponentManagerImpl.createComponent(ComponentManagerImpl.java:124)
    at com.intellij.openapi.application.impl.ApplicationImpl.createComponent(ApplicationImpl.java:358)
    at com.intellij.openapi.components.impl.ComponentManagerImpl.a(ComponentManagerImpl.java:115)
    at com.intellij.openapi.components.impl.ComponentManagerImpl.init(ComponentManagerImpl.java:86)
    at com.intellij.openapi.components.impl.stores.ApplicationStoreImpl.load(ApplicationStoreImpl.java:110)
    at com.intellij.openapi.application.impl.ApplicationImpl.load(ApplicationImpl.java:511)
    at com.intellij.openapi.application.impl.ApplicationImpl.load(ApplicationImpl.java:493)
    at com.intellij.idea.IdeaApplication.run(IdeaApplication.java:158)
    at com.intellij.idea.MainImpl$1$1$1.run(MainImpl.java:66)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:715)
    at java.awt.EventQueue.access$400(EventQueue.java:82)
    at java.awt.EventQueue$2.run(EventQueue.java:676)
    at java.awt.EventQueue$2.run(EventQueue.java:674)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:685)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:364)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

Support new types

In GLSL 4.5, there's: uint, double, uvec[234], dvec[234], dmat[234]x[234], and a bunch of new opaque types. It'd be good to support these.

crash on start (plugin version 1.2)

OSX Yosemite 10.10.2
IntelliJ IDEA 14.1
Build #IU-141.177, built on March 23, 2015
JRE: 1.6.0_65-b14-466.1-11M4716 x86_64
JVM: Java HotSpot(TM) 64-Bit Server VM by Apple Inc.

Plugin 'GLSL' failed to initialize and will be disabled.  Please restart IntelliJ IDEA.

com.intellij.diagnostic.PluginException: glslplugin/components/GLSLTemplatesLoader : Unsupported major.minor version 51.0 [Plugin: GLSL]
   ...

51.0 is java 1.7; it can't be run on 1.6, JDK 1.6 is required on OSX - It is possible to run IDEA on jdk 7/8 but with issues. Please provide version compiled for 1.6.

Substitute preprocessor definitions into token stream

Currently we just ignore the contents of all directives. #define should be able to actually define tokens to be expanded into another list of tokens. Ideally this would do function-like macros as well as variables, but variables only would be a good start.

Syntax colouring of conditional definitions is wrong

On version 1.7.1, having a precision marker inside an #ifdef/#endif block triggers invalid syntax colouring, as per screenshot:

screen shot 2015-05-17 at 12 14 13

Syntax colouring returns back to normal once a non-#ifdef/#endif block is found.

Certain text makes Intellij hang

For example

in.anything

puts parser into infinite loop and hangs Intellij which has to be force quit.

Generally, it is not very robust and syntax error tolerant. Next test cases:

void while

void main() {
}

Two consecutive operators

void in() {} and other keyword-named functions

Unable to install on IntelliJ 13

I am not able to install the Plugin in Intellij 13.
I get the message that the plugin is not compatible with the current version.

Not working on CLion

I've tried installing both of the precompiled versions of this plugin, but the GLSL files I have remain unhighlighted. The older version of this plugin on the Jetbrains repository does activate properly, but it's impossible to configure it so it looks good with the Darkula theme.

I'm running on CLion 1.0

Not able to use with Jetbrains AppCode

I get the following error on my Mac when trying to enable the GLSL plugin. I'm not sure if the error is related to AppCode or to the GLSL plugin.

Error message:
Plugin 'GLSL' failed to initialize and will be disabled. Please restart AppCode.

java.lang.NoSuchMethodError: com.intellij.ide.fileTemplates.FileTemplateManager.getDefaultInstance()Lcom/intellij/ide/fileTemplates/FileTemplateManager;
    at glslplugin.components.GLSLTemplatesLoader.initComponent(GLSLTemplatesLoader.java:39)
    at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentConfigComponentAdapter$1.getComponentInstance(ComponentManagerImpl.java:567)
    at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentConfigComponentAdapter.getComponentInstance(ComponentManagerImpl.java:609)
    at com.intellij.util.pico.DefaultPicoContainer.getLocalInstance(DefaultPicoContainer.java:236)
    at com.intellij.util.pico.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:223)
    at com.intellij.util.pico.DefaultPicoContainer.getComponentInstance(DefaultPicoContainer.java:210)
    at org.picocontainer.alternatives.AbstractDelegatingMutablePicoContainer.getComponentInstance(AbstractDelegatingMutablePicoContainer.java:75)
    at com.intellij.openapi.components.impl.ComponentManagerImpl.createComponent(ComponentManagerImpl.java:124)
    at com.intellij.openapi.application.impl.ApplicationImpl.createComponent(ApplicationImpl.java:358)
    at com.intellij.openapi.components.impl.ComponentManagerImpl.a(ComponentManagerImpl.java:115)
    at com.intellij.openapi.components.impl.ComponentManagerImpl.init(ComponentManagerImpl.java:86)
    at com.intellij.openapi.components.impl.stores.ApplicationStoreImpl.load(ApplicationStoreImpl.java:110)
    at com.intellij.openapi.application.impl.ApplicationImpl.load(ApplicationImpl.java:511)
    at com.intellij.openapi.application.impl.ApplicationImpl.load(ApplicationImpl.java:493)
    at com.intellij.idea.IdeaApplication.run(IdeaApplication.java:158)
    at com.intellij.idea.MainImpl$1$1$1.run(MainImpl.java:66)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:715)
    at java.awt.EventQueue.access$400(EventQueue.java:82)
    at java.awt.EventQueue$2.run(EventQueue.java:676)
    at java.awt.EventQueue$2.run(EventQueue.java:674)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:685)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:364)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

Build Instructions?

I'm not savy with building plugin jar, could you please provide some basic instructions?
Thanks

Version and stage should be parsed/inferred

At some point we're going to have to recognise the version and stage of a GLSL file. I know it's somehow possible to add those little drop-down menus to the bottom right of the IDE (eg. the Git plugin does it for the current branch, plus there's one for line endings and charset). I think it'd be good to detect it and populate menus down there so they can be manually changed if needed. I have no idea how to do this.

Understand preprocessor conditionals

Currently preprocessor conditionals are just ignored - everything in them is parsed as usual regardless of whether the condition is true. This would lead to parser errors in a bunch of different ways.

Can't create files with an extension other than .glsl

If I use 'Right click › New › GLSL Shader', and enter 'Shader.vert', it creates a new file called 'Shader.vert.glsl'. It still recognises it as a GLSL file, but I then have to manually rename it to 'Shader.vert'.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.