Discuss Scratch

NutOfCoco
Scratcher
100+ posts

Add GPU to custom blocks

Add GPU to custom blocks (previously “GPU Extension”)
Read MagentaDude1359's post for the definition of a GPU.

This is the new thougt:

I have decided that instead of being a new extension or block, it will be a check box inside of a custom block.

I have extensions that change the size and color of many things, so ignore those.

Last edited by NutOfCoco (7/16/2026 1:01:34)

This was the previous idea (though the rules on how the blocks work still apply):

set [i v] to (0)
GPU repeat () {
change [i v] by (1)
create clone of (myself v)

} ::#ffc158 // because bbcode is weird I will have to put a comment for the clone block here — the clone block will take properties of a GPU block

GPU when I start as a clone ::#ffc158 hat
Delete this clone // deletes GPU clone, if that wasn't obvious.

GPU blocks will not be able to do certain functions including:

read current global variables (including timer, days since 2000, etc…), (if one is used it will use the last input from before the GPU block started)

All following functions will act as if they are not there:

play sounds
broadcast messages
think, say, and move between layers
have most event blocks (wait () seconds, repeat (), forever, wait until <>, repeat until <>) (maybe stop)

I think I've said all that is needed, nothing seems to be too obscure. This would probably be only used for custom rendering, but I'm sure there are other use cases.

I don't know why I made GPU blocks a specific color, because they will just be the color of extension blocks.

Last edited by NutOfCoco (6/30/2026 11:21:59)

Maybe repeat blocks inside of an exist GPU block will turn GPU automatically.

GPU repeat until <> {

} :: #ffc158 // also a block

If a GPU repeat until block is stuck in a loop for too long it will stop playing.

It will probably take a long time to implement but I'm patient. And I don't know if WebGPU would render this useless or have to be added to do this.

Last edited by NutOfCoco (7/8/2026 8:35:05)

Last edited by NutOfCoco (July 18, 2026 17:55:16)

NutOfCoco
Scratcher
100+ posts

Add GPU to custom blocks

bump
NutOfCoco
Scratcher
100+ posts

Add GPU to custom blocks

bump
MagentaDude1359
Scratcher
100+ posts

Add GPU to custom blocks

Interesting idea, nice that you accounted for GPU limitations. Although, I think instead of different “GPU repeat” and “when I start as GPU clone” blocks, there should be a single “gpu wrapper” block:

when I start as a clone
gpu wrapper {
set [i v] to [1]
repeat (10)
change [i v] by (1)
end
} :: #ffc158
delete this clone

This would JIT-compile the blocks to a shader before the project is ran.

There should also be a feature where if an invalid GPU block (e.g. move 10 steps) is put in a GPU wrapper, there would be a red highlight outside the unsupported block and a message that says “This block is not supported by the GPU” with a link to a FAQ of supported GPU blocks.

It would also be cool if there were GPU-only blocks to draw lines and triangles from and to certain positions without having to use pen down, go to, and pen up, just to make it a bit faster.

Overall, support.
NutOfCoco
Scratcher
100+ posts

Add GPU to custom blocks

MagentaDude1359 wrote:

Interesting idea, nice that you accounted for GPU limitations. Although, I think instead of different “GPU repeat” and “when I start as GPU clone” blocks, there should be a single “gpu wrapper” block:

when I start as a clone
gpu wrapper {
set [i v] to [1]
repeat (10)
change [i v] by (1)
end
} :: #ffc158
delete this clone
The thing is, an extension with one block doesn't sound right. But still a good suggestion.

Last edited by NutOfCoco (July 9, 2026 20:33:48)

NutOfCoco
Scratcher
100+ posts

Add GPU to custom blocks

bump
NutOfCoco
Scratcher
100+ posts

Add GPU to custom blocks

bump
purplebunny63
Scratcher
500+ posts

Add GPU to custom blocks

What’s GPU?
MagentaDude1359
Scratcher
100+ posts

Add GPU to custom blocks

purplebunny63 wrote:

What’s GPU?
It stands for graphics processing unit. It is often compared to the CPU (central processing unit); they are both parts of your computer that are meant for executing instructions. The GPU is better at running the same tasks many times in parallel, e.g. for calculating the color of thousands of pixels at one time, but worse at performing complex, branching tasks, where the CPU is better suited. It is usually only used for graphical functions (hence the name), but is also used for other tasks that would otherwise be hard for the CPU, e.g. machine learning.
NutOfCoco
Scratcher
100+ posts

Add GPU to custom blocks

bump
bubgamer07
Scratcher
100+ posts

Add GPU to custom blocks

could you show some example uses?
NutOfCoco
Scratcher
100+ posts

Add GPU to custom blocks

bubgamer07 wrote:

could you show some example uses?
define draw picture // has "Run on GPU" ticked (see op)
set [x v] to (-240)
set [y v] to (-180)
set [i v] to (0)
set pen size to (1)
repeat (360)
repeat (480)
change [i v] by (1)
go to x (x) y (y)
set pen color to (item (i) of [picture v])
pen down
pen up
change [x v] by (1)
end
change [x v] by (-480)
change [y v] by (1)

and there are other blocks I am not going to make that are really useful and cool.
NutOfCoco
Scratcher
100+ posts

Add GPU to custom blocks

bump
scratchy_boy106
Scratcher
1000+ posts

Add GPU to custom blocks

Something weirds been happening on the suggestions forum lately, none of them make sense.
NutOfCoco
Scratcher
100+ posts

Add GPU to custom blocks

scratchy_boy106 wrote:

Something weirds been happening on the suggestions forum lately, none of them make sense.
Are you talking about this one, because I think it makes perfect sense.
scratchy_boy106
Scratcher
1000+ posts

Add GPU to custom blocks

NutOfCoco wrote:

scratchy_boy106 wrote:

Something weirds been happening on the suggestions forum lately, none of them make sense.
Are you talking about this one, because I think it makes perfect sense.
That's because it's your own topic.
scratchy_boy106
Scratcher
1000+ posts

Add GPU to custom blocks

What does it even do theres no point to have this block if it doesn't run the code inside
purplebunny63
Scratcher
500+ posts

Add GPU to custom blocks

scratchy_boy106 wrote:

NutOfCoco wrote:

scratchy_boy106 wrote:

Something weirds been happening on the suggestions forum lately, none of them make sense.
Are you talking about this one, because I think it makes perfect sense.
That's because it's your own topic.
There asking for blocks that the GPU runs and this is what GPU is:

MagentaDude1359 wrote:

purplebunny63 wrote:

What’s GPU?
It stands for graphics processing unit. It is often compared to the CPU (central processing unit); they are both parts of your computer that are meant for executing instructions. The GPU is better at running the same tasks many times in parallel, e.g. for calculating the color of thousands of pixels at one time, but worse at performing complex, branching tasks, where the CPU is better suited. It is usually only used for graphical functions (hence the name), but is also used for other tasks that would otherwise be hard for the CPU, e.g. machine learning.
NutOfCoco
Scratcher
100+ posts

Add GPU to custom blocks

scratchy_boy106 wrote:

What does it even do theres no point to have this block if it doesn't run the code inside
It does run the code, but on the GPU instead of the CPU. Read MagentaDude1359's post.
NutOfCoco
Scratcher
100+ posts

Add GPU to custom blocks

bump

Powered by DjangoBB