Skip to content

Commit

Permalink
shader_?_uniform_exists()
Browse files Browse the repository at this point in the history
  • Loading branch information
omicronrex committed Sep 22, 2024
1 parent 00dcbac commit 7779709
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 7 deletions.
24 changes: 23 additions & 1 deletion gm82dx9.gej
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"folder": "gm82",
"version": "1.0",
"author": "Floogle && renex",
"date": "28/08/2024",
"date": "21/09/2024",
"license": "Free to use, also for commercial games.",
"description": "Requires Game Maker 8.2 Network. Part of the standard Game Maker 8.2 distribution. This extension package upgrades Game Maker to DirectX version 9.0, providing extended render state control and HLSL9 shaders.",
"helpfile": "",
Expand Down Expand Up @@ -2535,6 +2535,17 @@
"argtypes": null,
"returntype": 2
},
{
"name": "shader_pixel_uniform_exists",
"extname": "",
"calltype": 2,
"helpline": "shader_pixel_uniform_exists(name)",
"hidden": false,
"argtypes": [
2
],
"returntype": 2
},
{
"name": "shader_pixel_uniform_f",
"extname": "",
Expand Down Expand Up @@ -2658,6 +2669,17 @@
"argtypes": null,
"returntype": 2
},
{
"name": "shader_vertex_uniform_exists",
"extname": "",
"calltype": 2,
"helpline": "shader_vertex_uniform_exists(name)",
"hidden": false,
"argtypes": [
2
],
"returntype": 2
},
{
"name": "shader_vertex_uniform_f",
"extname": "",
Expand Down
2 changes: 1 addition & 1 deletion source/gm82dx9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ GMREAL __gm82dx9_set_light(
double specular, double specular_factor
) {
///d3d_light_define_ext(index,type,x,y,z,dx,dy,dz,range,inner_rad,outer_rad,color_diffuse,diffuse_factor,color_specular,specular_factor)
//index: light number (use small integers)
//index: light number 0-7
//type: one of lt_point, lt_spotlight, or lt_sun
//x,y,z: light position (unused for sun lights)
//dx,dy,dz: direction vector (unused for point lights)
Expand Down
20 changes: 15 additions & 5 deletions source/shaders.gml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@
shader_pixel_set(__gm82dx9_default_ps)


#define shader_vertex_uniform_exists
///shader_vertex_uniform_exists(name)
return (__gm82dx9_get_vconst(argument0)!=noone)


#define shader_pixel_uniform_exists
///shader_pixel_uniform_exists(name)
return (__gm82dx9_get_pconst(argument0)!=noone)


#define shader_vertex_uniform_get_address
///shader_vertex_uniform_get_address(uniform)
var __addr;
Expand Down Expand Up @@ -277,11 +287,11 @@
shader_vertex_set_passthrough()

shader_pixel_set(argument0)
shader_pixel_uniform_f(shader_pixel_uniform_get_address("_iGlobalTime"),argument5)
shader_pixel_uniform_f(shader_pixel_uniform_get_address("_iTime"),argument5)
shader_pixel_uniform_f(shader_pixel_uniform_get_address("_iResolution"),argument3,argument4,0)
shader_pixel_uniform_f(shader_pixel_uniform_get_address("_iMouse"),x,y,0,0)
shader_pixel_uniform_f(shader_pixel_uniform_get_address("_iFrameRate"),room_speed)
if (shader_pixel_uniform_exists("_iGlobalTime")) shader_pixel_uniform_f("_iGlobalTime",argument5)
if (shader_pixel_uniform_exists("_iTime")) shader_pixel_uniform_f("_iTime",argument5)
if (shader_pixel_uniform_exists("_iResolution")) shader_pixel_uniform_f("_iResolution",argument3,argument4,0)
if (shader_pixel_uniform_exists("_iMouse")) shader_pixel_uniform_f("_iMouse",x,y,0,0)
if (shader_pixel_uniform_exists("_iFrameRate")) shader_pixel_uniform_f("_iFrameRate",room_speed)

draw_primitive_begin_texture(pr_trianglestrip,-1)
draw_vertex_texture(argument1,argument2,0,1)
Expand Down

0 comments on commit 7779709

Please sign in to comment.