// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_hlsl.cpp
// Function: spirv_cross::CompilerHLSL::image_type_hlsl_modern[abi:cxx11](spirv_cross::SPIRType const&, unsigned int)
string CompilerHLSL::image_type_hlsl_modern(const SPIRType &type, uint32_t)
{
	auto &imagetype = get<SPIRType>(type.image.type);
	const char *dim = nullptr;
	bool typed_load = false;
	uint32_t components = 4;

	switch (type.image.dim)
	{
	case Dim1D:
		typed_load = type.image.sampled == 2;
		dim = "1D";
		break;
	case Dim2D:
		typed_load = type.image.sampled == 2;
		dim = "2D";
		break;
	case Dim3D:
		typed_load = type.image.sampled == 2;
		dim = "3D";
		break;
	case DimCube:
		if (type.image.sampled == 2)
			SPIRV_CROSS_THROW("RWTextureCube does not exist in HLSL.");
		dim = "Cube";
		break;
	case DimRect:
		SPIRV_CROSS_THROW("Rectangle texture support is not yet implemented for HLSL."); // TODO
	case DimBuffer:
		if (type.image.sampled == 1)
			return join("Buffer<", type_to_glsl(imagetype), components, ">");
		else if (type.image.sampled == 2)
			return join("RWBuffer<", image_format_to_type(type.image.format, imagetype.basetype), ">");
		else
			SPIRV_CROSS_THROW("Sampler buffers must be either sampled or unsampled. Cannot deduce in runtime.");
	case DimSubpassData:
		dim = "2D";
		typed_load = false;
		break;
	default:
		SPIRV_CROSS_THROW("Invalid dimension.");
	}
	const char *arrayed = type.image.arrayed ? "Array" : "";
	const char *ms = type.image.ms ? "MS" : "";
	const char *rw = typed_load ? "RW" : "";
	return join(rw, "Texture", dim, ms, arrayed, "<",
	            typed_load ? image_format_to_type(type.image.format, imagetype.basetype) :
	                         join(type_to_glsl(imagetype), components),
	            ">");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x68, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movl 0x80(%rdx), %esi
movq %r14, %rdi
callq 0x90a4
movl $0x4, 0xc(%rsp)
movl 0x84(%r15), %ecx
cmpq $0x6, %rcx
ja 0x503ba
leaq 0x45e1b(%rip), %rdx     # 0x95f40
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
cmpl $0x2, 0x8c(%r15)
sete %bpl
leaq 0x4277d(%rip), %rcx     # 0x928be
jmp 0x501db
movl 0x8c(%r15), %ecx
cmpl $0x2, %ecx
je 0x502d6
cmpl $0x1, %ecx
jne 0x50405
movq (%r14), %r8
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
movq %rax, %rdx
xorl %ecx, %ecx
callq *0x98(%r8)
leaq 0x467b3(%rip), %rsi     # 0x96933
leaq 0x3f04d(%rip), %r8      # 0x8f1d4
leaq 0xc(%rsp), %rcx
movq %rbx, %rdi
movq %r15, %rdx
callq 0x5ec5a
jmp 0x50306
cmpl $0x2, 0x8c(%r15)
sete %bpl
leaq 0x42765(%rip), %rcx     # 0x92914
jmp 0x501db
cmpl $0x2, 0x8c(%r15)
je 0x5031e
leaq 0x42764(%rip), %rcx     # 0x9292a
jmp 0x501e8
cmpl $0x2, 0x8c(%r15)
sete %bpl
leaq 0x426fa(%rip), %rcx     # 0x928d5
movq %rcx, (%rsp)
jmp 0x501ee
leaq 0x426ed(%rip), %rcx     # 0x928d5
movq %rcx, (%rsp)
xorl %ebp, %ebp
leaq 0x426d4(%rip), %rdx     # 0x928c9
leaq 0x3f68b(%rip), %rcx     # 0x8f887
cmpb $0x0, 0x89(%r15)
cmoveq %rcx, %rdx
movq %rdx, 0x40(%rsp)
leaq 0x426da(%rip), %rdx     # 0x928ee
cmpb $0x0, 0x8a(%r15)
cmoveq %rcx, %rdx
movq %rdx, 0x38(%rsp)
testb %bpl, %bpl
je 0x5024c
leaq 0x4676c(%rip), %rcx     # 0x9699d
movq %rcx, 0x30(%rsp)
movl 0x90(%r15), %esi
movl 0xc(%rax), %edx
leaq 0x10(%rsp), %rdi
callq 0x504ed
jmp 0x5027d
movq %rcx, 0x30(%rsp)
movq (%r14), %r8
leaq 0x48(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
movq %rax, %rdx
xorl %ecx, %ecx
callq *0x98(%r8)
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rdx
movq %r15, %rsi
callq 0x5edf5
subq $0x8, %rsp
leaq 0x3ef4c(%rip), %rax     # 0x8f1d4
leaq 0x18(%rsp), %r10
leaq 0x42e39(%rip), %r11     # 0x930cd
leaq 0x46705(%rip), %rdx     # 0x969a0
leaq 0x38(%rsp), %rsi
leaq 0x8(%rsp), %rcx
leaq 0x40(%rsp), %r8
leaq 0x48(%rsp), %r9
movq %rbx, %rdi
pushq %rax
pushq %r10
pushq %r11
callq 0x5ed50
addq $0x20, %rsp
leaq 0x10(%rsp), %rdi
callq 0x6548
testb %bpl, %bpl
jne 0x50310
leaq 0x48(%rsp), %rdi
jmp 0x5030b
movl 0x90(%r15), %esi
movl 0xc(%rax), %edx
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x504ed
leaq 0x4663d(%rip), %rsi     # 0x96931
leaq 0x3eed9(%rip), %rcx     # 0x8f1d4
movq %rbx, %rdi
movq %r14, %rdx
callq 0x5ecd6
leaq 0x10(%rsp), %rdi
callq 0x6548
movq %rbx, %rax
addq $0x68, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x6140
movq %rax, %r14
leaq 0x465a0(%rip), %rsi     # 0x968d0
leaq 0x10(%rsp), %rdi
leaq 0x48(%rsp), %rdx
callq 0x6100
movb $0x1, %bpl
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x6f6e
xorl %ebp, %ebp
leaq 0x96a68(%rip), %rsi     # 0xe6dc0
movq 0x97c81(%rip), %rdx     # 0xe7fe0
movq %r14, %rdi
callq 0x6490
jmp 0x5044e
pushq $0x10
popq %rdi
callq 0x6140
movq %rax, %r14
leaq 0x46578(%rip), %rsi     # 0x968f6
leaq 0x10(%rsp), %rdi
leaq 0x48(%rsp), %rdx
callq 0x6100
movb $0x1, %bpl
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x6f6e
xorl %ebp, %ebp
leaq 0x96a1a(%rip), %rsi     # 0xe6dc0
movq 0x97c33(%rip), %rdx     # 0xe7fe0
movq %r14, %rdi
callq 0x6490
jmp 0x5044e
pushq $0x10
popq %rdi
callq 0x6140
movq %rax, %r14
leaq 0x465be(%rip), %rsi     # 0x9698a
leaq 0x10(%rsp), %rdi
leaq 0x48(%rsp), %rdx
callq 0x6100
movb $0x1, %bpl
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x6f6e
xorl %ebp, %ebp
leaq 0x969cc(%rip), %rsi     # 0xe6dc0
movq 0x97be5(%rip), %rdx     # 0xe7fe0
movq %r14, %rdi
callq 0x6490
jmp 0x5044e
pushq $0x10
popq %rdi
callq 0x6140
movq %rax, %r14
leaq 0x46524(%rip), %rsi     # 0x9693b
leaq 0x10(%rsp), %rdi
leaq 0x48(%rsp), %rdx
callq 0x6100
movb $0x1, %bpl
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x6f6e
xorl %ebp, %ebp
leaq 0x96981(%rip), %rsi     # 0xe6dc0
movq 0x97b9a(%rip), %rdx     # 0xe7fe0
movq %r14, %rdi
callq 0x6490
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x6548
testb %bpl, %bpl
je 0x504e5
jmp 0x504ba
jmp 0x50492
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x6548
testb %bpl, %bpl
je 0x504e5
jmp 0x504ba
jmp 0x50492
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x6548
testb %bpl, %bpl
je 0x504e5
jmp 0x504ba
movq %rax, %rbx
jmp 0x504ba
jmp 0x50499
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
jmp 0x504e0
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x6548
testb %bpl, %bpl
jne 0x504ba
jmp 0x504e5
movq %rax, %rbx
movq %r14, %rdi
callq 0x6200
jmp 0x504e5
movq %rax, %rbx
jmp 0x504db
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x6548
testb %bpl, %bpl
jne 0x504e5
leaq 0x48(%rsp), %rdi
callq 0x6548
movq %rbx, %rdi
callq 0x64b0