Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

WSL should have some post-instantiation type checking #176

Closed
litherum opened this issue Oct 14, 2018 · 8 comments
Closed

WSL should have some post-instantiation type checking #176

litherum opened this issue Oct 14, 2018 · 8 comments

Comments

@litherum
Copy link
Contributor

Migrated from https://bugs.webkit.org/show_bug.cgi?id=177303:

At 2017-09-21T15:50:45Z, fpizlo@apple.com wrote:
There are certain things that are easier to check after type instantiation.

Shader type checking is definitely in that category.

@litherum
Copy link
Contributor Author

At 2017-09-21T16:37:47Z, fpizlo@apple.com wrote:
Created attachment 321439
the patch

@litherum
Copy link
Contributor Author

At 2017-09-21T17:45:06Z, fpizlo@apple.com wrote:
Created attachment 321447
the patch

@litherum
Copy link
Contributor Author

At 2017-09-21T17:53:54Z, fpizlo@apple.com wrote:
Created attachment 321450
the patch

@litherum
Copy link
Contributor Author

At 2017-09-21T21:15:27Z, fpizlo@apple.com wrote:
*** Bug 177098 has been marked as a duplicate of this bug. ***

@litherum
Copy link
Contributor Author

At 2017-09-21T21:28:55Z, keith_miller@apple.com wrote:
Comment on attachment 321450
the patch

View in context: https://bugs.webkit.org/attachment.cgi?id=321450&action=review

r=me with some nits.

Tools/ChangeLog:26

  •    Finally, this removes the shader type checker's incomplete reimplementation of isPrimitive. That calls
    
  •    isPrimitive now.
    

I don't understand what this is saying. What is "That"? isPrimitive was/is a property. AFAICT, there is no isPrimitive function?

Tools/WebGPUShadingLanguageRI/LateChecker.js:31

  • constructor()
  • {
  •    super();
    
  • }

Nit: you can remove this. Unless you want to be really sure that no arguments are passed to Visitor.

Tools/WebGPUShadingLanguageRI/LateChecker.js:52

  •        if (!(node.returnType.type instanceof StructType))
    
  •            throw new WTypeError(node.origin.originString, "Vertex shader " + node.name + " must return a struct.");
    
  •        assertPrimitive(node.returnType);
    

Nit: you could probably move this and the one below out of the switch.

@litherum
Copy link
Contributor Author

At 2017-09-21T21:33:03Z, fpizlo@apple.com wrote:
(In reply to Keith Miller from comment #5)

Comment on attachment 321450 [details]
the patch

View in context:
https://bugs.webkit.org/attachment.cgi?id=321450&action=review

r=me with some nits.

Tools/ChangeLog:26

  •    Finally, this removes the shader type checker's incomplete reimplementation of isPrimitive. That calls
    
  •    isPrimitive now.
    

I don't understand what this is saying. What is "That"? isPrimitive was/is a
property. AFAICT, there is no isPrimitive function?

There is an isPrimitive getter all over the place. For example:

    let assertPrimitive = type => {
        if (!type.isPrimitive)
            throw new WTypeError(node.origin.originString, "Shader signature cannot include non-primitive type: " + type);
    }

Before, this code used its own probably-mostly-correct reimplementation:

    class NonNumericSearcher extends Visitor {
        constructor(name)
        {
            super();
            this._name = name;
        }
        visitArrayRefType(node)
        {
            throw new WTypeError(node.origin.originString, shaderFunc.name + " must transitively only have numeric types.");
        }
        visitPtrType(node)
        {
            throw new WTypeError(node.origin.originString, shaderFunc.name + " must transitively only have numeric types.");
        }
        visitTypeRef(node)
        {
            super.visitTypeRef(node);
            node.type.visit(this);
        }
    }

That was when this code lived in Checker, so the patch doesn't make this super obvious. I'll fix the changelog to refer to this defunct helper class by name.

Tools/WebGPUShadingLanguageRI/LateChecker.js:31

  • constructor()
  • {
  •    super();
    
  • }

Nit: you can remove this. Unless you want to be really sure that no
arguments are passed to Visitor.

Fixed.

Tools/WebGPUShadingLanguageRI/LateChecker.js:52

  •        if (!(node.returnType.type instanceof StructType))
    
  •            throw new WTypeError(node.origin.originString, "Vertex shader " + node.name + " must return a struct.");
    
  •        assertPrimitive(node.returnType);
    

Nit: you could probably move this and the one below out of the switch.

Fixed.

@litherum
Copy link
Contributor Author

At 2017-09-21T21:36:08Z, fpizlo@apple.com wrote:
Landed in https://trac.webkit.org/changeset/222351/webkit

@litherum
Copy link
Contributor Author

At 2017-09-27T19:23:25Z, webkit-bug-importer@group.apple.com wrote:
rdar://problem/34693183

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant