Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing the second texture/sampler when compiling for Metal #112

Open
ThrudTheBarbarian opened this issue Mar 2, 2025 · 0 comments
Open
Assignees

Comments

@ThrudTheBarbarian
Copy link

Using the attached compute shader, I get a main0 with only one input texture/sampler and one output texture. The HLSL defines two input textures/samplers and an output texture, and things go awry ...

This is with the artefact version of shadercross from 27th February.

Input looks like:

/*****************************************************************************\
|* Parameter declarations
\*****************************************************************************/

// Declare the constant buffer for passed-in uniforms.
cbuffer UBO : register(b0, space2)
	{                                                // size [actual]
        float height 		: packoffset(c0.x);	 // 16   [16]   Z perlin co-ord
        float period		: packoffset(c0.y);	 //  4   [ 0]   repeat-length
        float persistence	: packoffset(c0.z);	 //  4	 [ 0]	amplitude/octave
	int   octaves		: packoffset(c0.w);	 //  4   [ 0]   number of octaves
	float threshold		: packoffset(c1.x);      // 16	 [16]	black point
	uint  seed		: packoffset(c1.y);	 //  4   [ 0]   cubic seed
	uint  cperiod		: packoffset(c1.z);	 //  4   [ 0]   cubic period
	uint  algorithms	: packoffset(c1.w);	 //  4   [ 0]   which noise to use
	};

// Declare the output image texture. This is what is written to by the noise
// function as alpha, combined with the input RGB data
RWTexture2D<unorm float4> dstImage 		: register(u0, space1);

// Declare the input image texture and sampler
Texture2D<float4> 	srcImage 			: register(t0, space0);
SamplerState   		srcSampler 			: register(s0, space0);

// Declare the regions image texture and sampler
Texture2D<float4> 	rgnImage 			: register(t1, space0);
SamplerState   		rgnSampler 			: register(s1, space0);

but the main0 definition is:

kernel void main0(constant type_UBO& UBO [[buffer(0)]], 
                  texture2d<float> srcImage [[texture(0)]], 
                  texture2d<float, access::write> dstImage [[texture(1)]], 
                  sampler srcSampler [[sampler(0)]], 
                  uint3 gl_GlobalInvocationID [[thread_position_in_grid]])

shader.zip

@thatcosmonaut thatcosmonaut self-assigned this Mar 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants