HLSL sampler

This commit is contained in:
Tanasart 2023-09-16 11:04:50 +02:00
parent 09c9b9bd87
commit fa8b22b517
12 changed files with 168 additions and 12 deletions

View file

@ -936,6 +936,7 @@
{"name":"sh_d3d_shadow_depth","order":19,"path":"shaders/sh_d3d_shadow_depth/sh_d3d_shadow_depth.yy",},
{"name":"s_node_noise_fbm","order":26,"path":"sprites/s_node_noise_fbm/s_node_noise_fbm.yy",},
{"name":"sh_color_select_content","order":1,"path":"shaders/sh_color_select_content/sh_color_select_content.yy",},
{"name":"s_node_hlsl","order":32,"path":"sprites/s_node_hlsl/s_node_hlsl.yy",},
{"name":"scr_cmd_arg","order":3,"path":"scripts/scr_cmd_arg/scr_cmd_arg.yy",},
{"name":"sh_outline","order":18,"path":"shaders/sh_outline/sh_outline.yy",},
{"name":"s_node_strandSim_break","order":8,"path":"sprites/s_node_strandSim_break/s_node_strandSim_break.yy",},
@ -1259,6 +1260,7 @@
{"name":"fd_rectangle_enums","order":3,"path":"scripts/fd_rectangle_enums/fd_rectangle_enums.yy",},
{"name":"s_texture_default","order":1,"path":"sprites/s_texture_default/s_texture_default.yy",},
{"name":"directory_object","order":3,"path":"scripts/directory_object/directory_object.yy",},
{"name":"s_node_isosurf","order":2,"path":"sprites/s_node_isosurf/s_node_isosurf.yy",},
{"name":"node_pb_box_divide","order":5,"path":"scripts/node_pb_box_divide/node_pb_box_divide.yy",},
{"name":"node_websocket_sender","order":1,"path":"scripts/node_websocket_sender/node_websocket_sender.yy",},
{"name":"fd_rectangle_get_acceleration_b","order":1,"path":"scripts/fd_rectangle_get_acceleration_b/fd_rectangle_get_acceleration_b.yy",},

View file

@ -1568,6 +1568,7 @@
{"id":{"name":"sh_d3d_shadow_depth","path":"shaders/sh_d3d_shadow_depth/sh_d3d_shadow_depth.yy",},},
{"id":{"name":"s_node_noise_fbm","path":"sprites/s_node_noise_fbm/s_node_noise_fbm.yy",},},
{"id":{"name":"sh_color_select_content","path":"shaders/sh_color_select_content/sh_color_select_content.yy",},},
{"id":{"name":"s_node_hlsl","path":"sprites/s_node_hlsl/s_node_hlsl.yy",},},
{"id":{"name":"scr_cmd_arg","path":"scripts/scr_cmd_arg/scr_cmd_arg.yy",},},
{"id":{"name":"sh_outline","path":"shaders/sh_outline/sh_outline.yy",},},
{"id":{"name":"s_node_strandSim_break","path":"sprites/s_node_strandSim_break/s_node_strandSim_break.yy",},},
@ -1940,6 +1941,7 @@
{"id":{"name":"fd_rectangle_enums","path":"scripts/fd_rectangle_enums/fd_rectangle_enums.yy",},},
{"id":{"name":"s_texture_default","path":"sprites/s_texture_default/s_texture_default.yy",},},
{"id":{"name":"directory_object","path":"scripts/directory_object/directory_object.yy",},},
{"id":{"name":"s_node_isosurf","path":"sprites/s_node_isosurf/s_node_isosurf.yy",},},
{"id":{"name":"node_combine_hsv","path":"scripts/node_combine_hsv/node_combine_hsv.yy",},},
{"id":{"name":"node_pb_box_divide","path":"scripts/node_pb_box_divide/node_pb_box_divide.yy",},},
{"id":{"name":"node_dilate","path":"scripts/node_dilate/node_dilate.yy",},},

Binary file not shown.

View file

@ -75,7 +75,10 @@ function hlsl_document_parser(prompt, node = noone) {
var _arg_name = node.inputs[| i + 0].getValue();
var _arg_type = node.inputs[| i + 1].getValue();
array_push(params, [ _arg_name, array_safe_get(global.HLSL_VAR, _arg_type) ]);
if(_arg_type == 7) {
array_push(params, [ _arg_name + "Object", "Texture2D" ]);
array_push(params, [ _arg_name, "SamplerState" ]);
} else array_push(params, [ _arg_name, array_safe_get(global.HLSL_VAR, _arg_type) ]);
}
for( var i = 0, n = array_length(lines); i < n; i++ ) {

View file

@ -229,9 +229,9 @@ struct PixelShaderOutput {
fs = fs_pre + fs_param + fs_pos;
file_text_write_all(_dir + "fout.shader", fs);
print("==================== Compiling ====================");
print(fs)
print("===================================================\n");
//print("==================== Compiling ====================");
//print(fs)
//print("===================================================\n");
shader.vs = d3d11_shader_compile_vs(_dir + "vout.shader", "main", "vs_4_0");
if (!d3d11_shader_exists(shader.vs))
@ -273,10 +273,11 @@ struct PixelShaderOutput {
for( var i = input_fix_len, n = array_length(_data); i < n; i += data_length ) {
var _arg_name = _data[i + 0];
if(_arg_name == "") continue;
var _arg_type = _data[i + 1];
var _arg_valu = _data[i + 2];
if(_arg_name == "") continue;
var _uni = shader_get_uniform(shader.fs, _arg_name);
switch(_arg_type) {
@ -301,8 +302,8 @@ struct PixelShaderOutput {
d3d11_cbuffer_add_float(array_length(_arg_valu));
_cbSize += array_length(_arg_valu);
for( var i = 0, n = array_length(_arg_valu); i < n; i++ )
buffer_write(_buffer, buffer_f32, _arg_valu[i]);
for( var j = 0, m = array_length(_arg_valu); j < m; j++ )
buffer_write(_buffer, buffer_f32, _arg_valu[j]);
}
break;
case 8 :
@ -310,7 +311,7 @@ struct PixelShaderOutput {
d3d11_cbuffer_add_float(4);
_cbSize += 4;
for( var i = 0, n = 4; i < n; i++ )
for( var j = 0, m = 4; j < m; j++ )
buffer_write(_buffer, buffer_f32, _clr[i]);
break;
case 7 :

View file

@ -589,8 +589,8 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor {
addNodeObject(values, "Atlas Set", s_node_atlas_set, "Node_Atlas_Set", [1, Node_Atlas_Set]).setVersion(1141);
ds_list_add(values, "Surface");
addNodeObject(values, "Dynamic Surface", s_node_surface_from_buffer, "Node_DynaSurf", [1, Node_DynaSurf]).setVersion(11520);
addNodeObject(values, "IsoSurf", s_node_surface_from_buffer, "Node_IsoSurf", [1, Node_IsoSurf]).setVersion(11520);
//addNodeObject(values, "Dynamic Surface", s_node_surface_from_buffer, "Node_DynaSurf", [1, Node_DynaSurf]).setVersion(11520);
addNodeObject(values, "IsoSurf", s_node_isosurf, "Node_IsoSurf", [1, Node_IsoSurf]).setVersion(11520);
addNodeObject(values, "Surface from Buffer", s_node_surface_from_buffer, "Node_Surface_From_Buffer", [1, Node_Surface_From_Buffer], ["buffer to surface"], "Create surface from buffer.").setVersion(1146);
ds_list_add(values, "Buffer");
@ -658,7 +658,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor {
addNodeObject(node, "Lua Compute", s_node_lua_compute, "Node_Lua_Compute", [1, Node_Lua_Compute]).setVersion(1090);
ds_list_add(node, "Shader");
addNodeObject(node, "HLSL", s_node_lua_compute, "Node_HLSL", [1, Node_HLSL]).setVersion(11520);
addNodeObject(node, "HLSL", s_node_hlsl, "Node_HLSL", [1, Node_HLSL]).setVersion(11520);
ds_list_add(node, "Organize");
addNodeObject(node, "Pin", s_node_pin, "Node_Pin", [1, Node_Pin],, "Craete pin to organize your connection. Can be create by double clicking on a connection line.");

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View file

@ -0,0 +1,74 @@
{
"resourceType": "GMSprite",
"resourceVersion": "1.0",
"name": "s_node_hlsl",
"bbox_bottom": 61,
"bbox_left": 2,
"bbox_right": 61,
"bbox_top": 2,
"bboxMode": 0,
"collisionKind": 1,
"collisionTolerance": 0,
"DynamicTexturePage": false,
"edgeFiltering": false,
"For3D": false,
"frames": [
{"resourceType":"GMSpriteFrame","resourceVersion":"1.1","name":"3c27d1da-9ef8-4324-ad9f-23ef4ea91a10",},
],
"gridX": 0,
"gridY": 0,
"height": 64,
"HTile": false,
"layers": [
{"resourceType":"GMImageLayer","resourceVersion":"1.0","name":"4051e4f4-9f55-4752-bc3c-f87f5a542bf4","blendMode":0,"displayName":"default","isLocked":false,"opacity":100.0,"visible":true,},
],
"nineSlice": null,
"origin": 4,
"parent": {
"name": "node",
"path": "folders/nodes/icons/node.yy",
},
"preMultiplyAlpha": false,
"sequence": {
"resourceType": "GMSequence",
"resourceVersion": "1.4",
"name": "s_node_hlsl",
"autoRecord": true,
"backdropHeight": 768,
"backdropImageOpacity": 0.5,
"backdropImagePath": "",
"backdropWidth": 1366,
"backdropXOffset": 0.0,
"backdropYOffset": 0.0,
"events": {"resourceType":"KeyframeStore<MessageEventKeyframe>","resourceVersion":"1.0","Keyframes":[],},
"eventStubScript": null,
"eventToFunction": {},
"length": 1.0,
"lockOrigin": false,
"moments": {"resourceType":"KeyframeStore<MomentsEventKeyframe>","resourceVersion":"1.0","Keyframes":[],},
"playback": 1,
"playbackSpeed": 30.0,
"playbackSpeedType": 0,
"showBackdrop": true,
"showBackdropImage": false,
"timeUnits": 1,
"tracks": [
{"resourceType":"GMSpriteFramesTrack","resourceVersion":"1.0","name":"frames","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"resourceType":"KeyframeStore<SpriteFrameKeyframe>","resourceVersion":"1.0","Keyframes":[
{"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"1.0","Channels":{"0":{"resourceType":"SpriteFrameKeyframe","resourceVersion":"1.0","Id":{"name":"3c27d1da-9ef8-4324-ad9f-23ef4ea91a10","path":"sprites/s_node_hlsl/s_node_hlsl.yy",},},},"Disabled":false,"id":"1f6aa100-a164-4e38-9fff-d5b824f78881","IsCreationKey":false,"Key":0.0,"Length":1.0,"Stretch":false,},
],},"modifiers":[],"spriteId":null,"trackColour":0,"tracks":[],"traits":0,},
],
"visibleRange": null,
"volume": 1.0,
"xorigin": 32,
"yorigin": 32,
},
"swatchColours": null,
"swfPrecision": 2.525,
"textureGroupId": {
"name": "Default",
"path": "texturegroups/Default",
},
"type": 0,
"VTile": false,
"width": 64,
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -0,0 +1,74 @@
{
"resourceType": "GMSprite",
"resourceVersion": "1.0",
"name": "s_node_isosurf",
"bbox_bottom": 61,
"bbox_left": 2,
"bbox_right": 61,
"bbox_top": 2,
"bboxMode": 0,
"collisionKind": 1,
"collisionTolerance": 0,
"DynamicTexturePage": false,
"edgeFiltering": false,
"For3D": false,
"frames": [
{"resourceType":"GMSpriteFrame","resourceVersion":"1.1","name":"5cca1347-1d83-4e36-9c21-80870b475cf6",},
],
"gridX": 0,
"gridY": 0,
"height": 64,
"HTile": false,
"layers": [
{"resourceType":"GMImageLayer","resourceVersion":"1.0","name":"30241054-064e-49f1-bc35-bdb0f5f55546","blendMode":0,"displayName":"default","isLocked":false,"opacity":100.0,"visible":true,},
],
"nineSlice": null,
"origin": 4,
"parent": {
"name": "surface",
"path": "folders/nodes/icons/value/surface.yy",
},
"preMultiplyAlpha": false,
"sequence": {
"resourceType": "GMSequence",
"resourceVersion": "1.4",
"name": "s_node_isosurf",
"autoRecord": true,
"backdropHeight": 768,
"backdropImageOpacity": 0.5,
"backdropImagePath": "",
"backdropWidth": 1366,
"backdropXOffset": 0.0,
"backdropYOffset": 0.0,
"events": {"resourceType":"KeyframeStore<MessageEventKeyframe>","resourceVersion":"1.0","Keyframes":[],},
"eventStubScript": null,
"eventToFunction": {},
"length": 1.0,
"lockOrigin": false,
"moments": {"resourceType":"KeyframeStore<MomentsEventKeyframe>","resourceVersion":"1.0","Keyframes":[],},
"playback": 1,
"playbackSpeed": 30.0,
"playbackSpeedType": 0,
"showBackdrop": true,
"showBackdropImage": false,
"timeUnits": 1,
"tracks": [
{"resourceType":"GMSpriteFramesTrack","resourceVersion":"1.0","name":"frames","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"resourceType":"KeyframeStore<SpriteFrameKeyframe>","resourceVersion":"1.0","Keyframes":[
{"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"1.0","Channels":{"0":{"resourceType":"SpriteFrameKeyframe","resourceVersion":"1.0","Id":{"name":"5cca1347-1d83-4e36-9c21-80870b475cf6","path":"sprites/s_node_isosurf/s_node_isosurf.yy",},},},"Disabled":false,"id":"f9ba1475-ed04-42c0-8fe1-7ee05bb74f02","IsCreationKey":false,"Key":0.0,"Length":1.0,"Stretch":false,},
],},"modifiers":[],"spriteId":null,"trackColour":0,"tracks":[],"traits":0,},
],
"visibleRange": null,
"volume": 1.0,
"xorigin": 32,
"yorigin": 32,
},
"swatchColours": null,
"swfPrecision": 2.525,
"textureGroupId": {
"name": "Default",
"path": "texturegroups/Default",
},
"type": 0,
"VTile": false,
"width": 64,
}