From 402d9d67a4c905273f68c0c4330326e6bb0df00c Mon Sep 17 00:00:00 2001 From: Niels Bross Date: Wed, 26 Jun 2024 13:49:39 +0200 Subject: [PATCH] Change typenames. Bug in hlsl builtins --- Semantic_Analysis.jai | 6 +++--- hlsl_builtin.jai | 4 +++- test/texture_sample.shd | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Semantic_Analysis.jai b/Semantic_Analysis.jai index 4caecfc..1ced3c0 100644 --- a/Semantic_Analysis.jai +++ b/Semantic_Analysis.jai @@ -50,8 +50,8 @@ Typenames :: string.[ "half" , "float" , "double" , - "texture2D", - "sampler" , + "Texture2D", + "Sampler" , ]; Type_Variable :: struct { @@ -902,9 +902,9 @@ declare_struct :: (checker : *Semantic_Checker, node : *AST_Node, name : string) if child.kind == .FieldList { for field : child.children { type_var := check_node(checker, field); - h2tv(checker, type_var).scope = scope_handle; if type_var > 0 { + h2tv(checker, type_var).scope = scope_handle; add_child(checker, handle, type_var); } } diff --git a/hlsl_builtin.jai b/hlsl_builtin.jai index db68d32..05decc2 100644 --- a/hlsl_builtin.jai +++ b/hlsl_builtin.jai @@ -259,6 +259,8 @@ int4x4 :: struct { #foreign atan2 :: (float2, float2) -> float2; #foreign atan2 :: (float3, float3) -> float3; #foreign atan2 :: (float4, float4) -> float4; -#foreign atan2 :: (float4x4, float4x4) -> float4x4; + #foreign atan2 :: (float4x4, float4x4) -> float4x4; + + #foreign sample :: (texture : Texture2D, uv : float2, sampler : Sampler) -> float4; DONE diff --git a/test/texture_sample.shd b/test/texture_sample.shd index 12290fb..63c89df 100644 --- a/test/texture_sample.shd +++ b/test/texture_sample.shd @@ -1,6 +1,6 @@ p :: properties { - texture : texture2D; - sampler : sampler; + texture : Texture2D; + sampler : Sampler; } PS_Input :: struct {