• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Question - Code HLSL9 shaders not working?

xygthop3

Member
I've been using the same basic HLSL9 shader since 2013 and its worked great with GMS 1.x, are HLSL9 shaders currently implemented with GMS2?

I've right-clicked on the shader and set the shader type to HLSL 9. Target platform is set to Windows - VM.

GMS2 error: (GMS1.x was much better with error reports with HLSL btw :p )
The interesting part of this error is the line: Invalid shader (is it marked as incompatible type for this target?) "shader0":

DirectX11: Using hardware device
Invalid shader (is it marked as incompatible type for this target?) "shader0":
Total memory used = 2773946(0x002a53ba) bytes
ERROR!!! :: ############################################################################################
FATAL ERROR in Vertex Shader compilation

ShaderName: shader0


Invalid shader

at gml_Object_object0_Draw_0 (line 1) - shader_set(shader0);
############################################################################################
And the shader code I've always used and still use without issue in GMS1

Vertex:
Code:
//
// Simple passthrough vertex shader (HLSL9)
//
  struct a2v { //in from attributes to vertex
    float4 Position : POSITION;
    float4 Color    : COLOR0;
    float2 Texcoord : TEXCOORD0;
  };
 
  struct v2p { //out from vertex to pixel
    float4 Position : POSITION;
    float4 Color    : COLOR0;
    float2 Texcoord : TEXCOORD0;
  };
 
void main(in a2v IN, out v2p OUT)
{
    OUT.Position = mul(gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION], IN.Position);
    OUT.Color = IN.Color;
    OUT.Texcoord = IN.Texcoord;
}
Fragment:
Code:
//
// Simple passthrough fragment shader (HLSL9)
//
  struct v2p { //in from vertex to pixel
    float4 Color    : COLOR0;
    float2 Texcoord       : TEXCOORD0;
  };

  struct p2s { //out from pixel to screen
    float4 Color    : COLOR;
  };
 
void main(in v2p IN, out p2s OUT)
{
    OUT.Color = IN.Color * tex2D(gm_BaseTexture, IN.Texcoord);
}
Whats making me feel like HLSL 9 hasn't been implemented yet is that there is almost no syntax highlighting of the shader code (compared to GMS 1.x)
 

rwkay

GameMaker Staff
GameMaker Dev.
HLSL9 shaders are specific for DX9 which we do not support any more... you need to convert it to HLSL11 yourself

Russell
 

rwkay

GameMaker Staff
GameMaker Dev.
I believe we have on the internal version (which will become the next public version soon)

Russell
 

gnysek

Member
Last time you said something comes public version soon, two hours later there was next beta available, so... :squirrel: :)
 
Top