Graphic 3D
2D, 3D, game, games, online game, game development, game engine, programming, OpenGL, Open AI, math, graphics, design, graphic, graphics, game development, game engine, programming, web development, web art, web graphic, arts, tutorial, tutorials,
marți, 1 decembrie 2026
FASM : Check FMA3 , OSXSAVE, XGETBV and AVX2 .
To add FMA3 and AVX2 in the same style (using write, print_yesno, and segment readable writeable), you need to check FMA3 (CPUID leaf 1, ECX bit 12). Then check OSXSAVE (CPUID leaf 1, ECX bit 27) and XGETBV (XCR0 bits 1 and 2), so that AVX, FMA3, and AVX2 are reported as YES only when the operating system saves the YMM registers.
Last, check AVX2 (CPUID leaf 7, sub-leaf 0, EBX bit 5), after confirming that the maximum standard leaf (EAX from leaf 0) is at least 7.The FMA3: Executes a \times b + c in one instruction with a single rounding, boosting speed and numerical accuracy.The AVX2: Extends 256-bit YMM vector operations to integers and adds faster register permutations and gather loads.The OSXSAVE: Indicates that the OS enabled XSAVE/XGETBV support so YMM state can be managed safely.The XGETBV: Reads XCR0 to verify that the OS actually saves and restores XMM (bit 1) and YMM (bit 2) registers across context switches.
Let's see source code:
format ELF64 executable 3
segment readable executable
entry main
main:
; Vendor: CPUID leaf 0 (EBX, EDX, ECX = 12 caractere)
xor eax, eax
cpuid
mov dword [max_leaf], eax
mov dword [vendor], ebx
mov dword [vendor+4], edx
mov dword [vendor+8], ecx
lea rsi, [lbl_vendor]
mov rdx, lbl_vendor_len
call write
lea rsi, [vendor]
mov rdx, 12
call write
call newline
; Brand string: leaf-urile 0x80000002..0x80000004 (48 caractere)
mov eax, 0x80000000
cpuid
cmp eax, 0x80000004
jb no_brand
mov r8d, 0x80000002
lea rdi, [brand]
brand_loop:
mov eax, r8d
cpuid
mov dword [rdi], eax
mov dword [rdi+4], ebx
mov dword [rdi+8], ecx
mov dword [rdi+12], edx
add rdi, 16
inc r8d
cmp r8d, 0x80000004
jbe brand_loop
lea rsi, [lbl_brand]
mov rdx, lbl_brand_len
call write
lea rsi, [brand]
mov rdx, 48
call write
call newline
jmp features
no_brand:
lea rsi, [lbl_nobrand]
mov rdx, lbl_nobrand_len
call write
features:
; Flaguri de baza: CPUID leaf 1 - EDX bit 26 = SSE2, ECX bit 12 = FMA3, ECX bit 28 = AVX
mov eax, 1
xor ecx, ecx
cpuid
mov dword [feat_edx], edx
mov dword [feat_ecx], ecx
; Verificam daca OS-ul a activat XMM (bit 1) si YMM (bit 2) in XCR0
xor r8d, r8d ; r8d = 1 daca AVX/YMM este activ in OS, altfel 0
bt ecx, 27 ; OSXSAVE
jnc .print_flags
bt ecx, 28 ; AVX hardware
jnc .print_flags
push rcx
xor ecx, ecx
xgetbv ; EDX:EAX = XCR0
pop rcx
and eax, 0x6 ; biții 1 (XMM) si 2 (YMM)
cmp eax, 0x6
jne .print_flags
mov r8d, 1
.print_flags:
; SSE2
lea rsi, [lbl_sse2]
mov rdx, lbl_sse2_len
call write
mov eax, [feat_edx]
shr eax, 26
and eax, 1
call print_yesno
; AVX (necesita suport CPU + activare OS prin XGETBV)
lea rsi, [lbl_avx]
mov rdx, lbl_avx_len
call write
mov eax, r8d
call print_yesno
; FMA3 (necesita ECX bit 12 in leaf 1 + YMM activ in OS)
lea rsi, [lbl_fma3]
mov rdx, lbl_fma3_len
call write
mov eax, [feat_ecx]
shr eax, 12
and eax, 1
and eax, r8d
call print_yesno
; AVX2: CPUID leaf 7, sub-leaf 0 -> EBX bit 5 (plus YMM activ in OS)
lea rsi, [lbl_avx2]
mov rdx, lbl_avx2_len
call write
xor eax, eax
cmp dword [max_leaf], 7
jb .show_avx2
mov eax, 7
xor ecx, ecx
cpuid
shr ebx, 5
and ebx, 1
and ebx, r8d
mov eax, ebx
.show_avx2:
call print_yesno
call exit
; eax = 1 -> "DA", altfel "NU"
print_yesno:
test eax, eax
jz .no
lea rsi, [yes]
mov rdx, 3
call write
ret
.no:
lea rsi, [no]
mov rdx, 3
call write
ret
; rsi = adresa, rdx = lungime
write:
mov eax, 1 ; sys_write
mov edi, 1 ; stdout
syscall
ret
newline:
lea rsi, [nl]
mov rdx, 1
call write
ret
exit:
mov eax, 60 ; sys_exit
xor edi, edi
syscall
segment readable writeable
max_leaf dd 0
vendor rb 12
brand rb 48
feat_edx dd 0
feat_ecx dd 0
lbl_vendor db "Vendor: "
lbl_vendor_len = $ - lbl_vendor
lbl_brand db "Model: "
lbl_brand_len = $ - lbl_brand
lbl_nobrand db "Model: necunoscut", 10
lbl_nobrand_len = $ - lbl_nobrand
lbl_sse2 db "SSE2: "
lbl_sse2_len = $ - lbl_sse2
lbl_avx db "AVX: "
lbl_avx_len = $ - lbl_avx
lbl_fma3 db "FMA3: "
lbl_fma3_len = $ - lbl_fma3
lbl_avx2 db "AVX2: "
lbl_avx2_len = $ - lbl_avx2
yes db "DA", 10
no db "NU", 10
nl db 10The result is:
flat assembler version 1.73.35 (16384 kilobytes memory, x64)
3 passes, 818 bytes.
Vendor: AuthenticAMD
Model: AMD Ryzen 5 3600 6-Core Processor .
SSE2: DA
AVX: DA
FMA3: DA
AVX2: DAFASM : detect CPU hardware with cpuid .
Detect hardware CPU with FASM, see this source code:
format ELF64 executable 3
segment readable executable
entry main
main:
; Vendor: CPUID leaf 0 (EBX, EDX, ECX = 12 caractere)
xor eax, eax
cpuid
mov dword [vendor], ebx
mov dword [vendor+4], edx
mov dword [vendor+8], ecx
lea rsi, [lbl_vendor]
mov rdx, lbl_vendor_len
call write
lea rsi, [vendor]
mov rdx, 12
call write
call newline
; Brand string: leaf-urile 0x80000002..0x80000004 (48 caractere)
mov eax, 0x80000000
cpuid
cmp eax, 0x80000004
jb no_brand
mov r8d, 0x80000002
lea rdi, [brand]
brand_loop:
mov eax, r8d
cpuid
mov dword [rdi], eax
mov dword [rdi+4], ebx
mov dword [rdi+8], ecx
mov dword [rdi+12], edx
add rdi, 16
inc r8d
cmp r8d, 0x80000004
jbe brand_loop
lea rsi, [lbl_brand]
mov rdx, lbl_brand_len
call write
lea rsi, [brand]
mov rdx, 48
call write
call newline
jmp features
no_brand:
lea rsi, [lbl_nobrand]
mov rdx, lbl_nobrand_len
call write
features:
; Flaguri: CPUID leaf 1 - EDX bit 26 = SSE2, ECX bit 28 = AVX
mov eax, 1
cpuid
mov dword [feat_edx], edx
mov dword [feat_ecx], ecx
lea rsi, [lbl_sse2]
mov rdx, lbl_sse2_len
call write
mov eax, [feat_edx]
shr eax, 26
and eax, 1
call print_yesno
lea rsi, [lbl_avx]
mov rdx, lbl_avx_len
call write
mov eax, [feat_ecx]
shr eax, 28
and eax, 1
call print_yesno
call exit
; eax = 1 -> "DA", altfel "NU"
print_yesno:
test eax, eax
jz .no
lea rsi, [yes]
mov rdx, 3
call write
ret
.no:
lea rsi, [no]
mov rdx, 3
call write
ret
; rsi = adresa, rdx = lungime
write:
mov eax, 1 ; sys_write
mov edi, 1 ; stdout
syscall
ret
newline:
lea rsi, [nl]
mov rdx, 1
call write
ret
exit:
mov eax, 60 ; sys_exit
xor edi, edi
syscall
segment readable writeable
vendor rb 12
brand rb 48
feat_edx dd 0
feat_ecx dd 0
lbl_vendor db "Vendor: "
lbl_vendor_len = $ - lbl_vendor
lbl_brand db "Model: "
lbl_brand_len = $ - lbl_brand
lbl_nobrand db "Model: necunoscut", 10
lbl_nobrand_len = $ - lbl_nobrand
lbl_sse2 db "SSE2: "
lbl_sse2_len = $ - lbl_sse2
lbl_avx db "AVX: "
lbl_avx_len = $ - lbl_avx
yes db "DA", 10
no db "NU", 10
nl db 10
Let's see result:
flat assembler version 1.73.35 (16384 kilobytes memory, x64)
3 passes, 670 bytes.
Vendor: AuthenticAMD
Model: AMD Ryzen 5 3600 6-Core Processor .
SSE2: DA
AVX: DA
luni, 30 noiembrie 2026
Shader Editor : flag of Romania with basic colors - example 007.
Today, the flag of Romania with basic colors: blue, yellow, red.

Let's see source code:
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
uniform vec2 resolution;
uniform float time;
uniform vec3 gravity;
vec2 rotate2D(vec2 v, float angle) {
float s = sin(angle);
float c = cos(angle);
return vec2(v.x * c - v.y * s, v.x * s + v.y * c);
}
void main(void) {
vec2 uv = gl_FragCoord.xy / resolution.xy;
//
vec2 rawTilt = gravity.xy / 9.81;
float mag = length(rawTilt);
float smoothMag = smoothstep(0.03, 0.35, mag) * clamp(mag, 0.0, 1.2);
vec2 safeTilt = (mag > 0.0001) ? (rawTilt / mag) * smoothMag : vec2(0.0);
//
float windAngle = safeTilt.x * 1.35 - safeTilt.y * 1.35;
vec2 windDir = rotate2D(normalize(vec2(1.0, 0.18)), windAngle);
float windSpeed = 3.2 + smoothMag * 2.8;
//
float warpA = sin(uv.x * 5.3 + uv.y * 8.7 + time * 1.15);
float warpB = cos(uv.x * 9.1 - uv.y * 6.4 - time * 0.85);
vec2 warpedUV = uv + vec2(warpA * 0.035, warpB * 0.045);
//
float dWind = dot(warpedUV - 0.5, windDir);
float p1 = dWind * 7.2 + warpedUV.y * 4.6 - time * windSpeed;
float p2 = dWind * 12.7 - warpedUV.y * 7.9 - time * (windSpeed * 1.28) + 1.7;
float p3 = dot(warpedUV, rotate2D(vec2(1.0, -0.6), windAngle * 0.6)) * 18.5 - time * (windSpeed * 0.92) + 3.4;
float w1 = sin(p1);
float w2 = sin(p2) * 0.55;
float w3 = sin(p3) * 0.25;
float wave = (w1 + w2 + w3) / 1.8;
float eps = 0.015;
vec2 uvX = uv + vec2(eps, 0.0);
vec2 uvY = uv + vec2(0.0, eps);
float wX = sin(dot(uvX - 0.5, windDir) * 7.2 + uvX.y * 4.6 - time * windSpeed) + sin(dot(uvX - 0.5, windDir) * 12.7 - uvX.y * 7.9 - time * (windSpeed * 1.28) + 1.7) * 0.55;
float wY = sin(dot(uvY - 0.5, windDir) * 7.2 + uvY.y * 4.6 - time * windSpeed) + sin(dot(uvY - 0.5, windDir) * 12.7 - uvY.y * 7.9 - time * (windSpeed * 1.28) + 1.7) * 0.55;
float dWaveX = (wX - wave * 1.8) / eps;
float dWaveY = (wY - wave * 1.8) / eps;
// moving
vec2 flagUV = uv + windDir * (wave * 0.009) + vec2(0.0, wave * 0.012);
// Romania flag with basic colors
vec3 blue = vec3(0.0, 0.168, 0.498);
vec3 yellow = vec3(0.988, 0.819, 0.086);
vec3 red = vec3(0.807, 0.066, 0.149);
vec3 color = red;
if (flagUV.y > 0.6666) {
color = blue;
} else if (flagUV.y > 0.3333) {
color = yellow;
}
// shadows
vec2 lightDir = normalize(windDir + safeTilt * 1.2 + vec2(-0.25, 0.45));
float slopeLight = dWaveX * lightDir.x + dWaveY * lightDir.y;
float shading = clamp(1.0 + slopeLight * 0.0032, 0.68, 1.32);
color *= shading;
gl_FragColor = vec4(color, 1.0);
}duminică, 29 noiembrie 2026
News : GIMP development update.
Hi! I’m one of the contributors to GIMP. You might be familiar with my previous work, such as adding support for essential file formats, exploring cutting-edge color space models, and perhaps my greatest achievement, moving the “About” option to the bottom of the Help menu.
See the official website.
Tool : gemini AI can help with LaTeX
LaTeX (pronounced LAH-tekh or LAY-tekh) is a document preparation system used for high-quality typesetting, primarily for scientific, mathematical, and technical documents.
Ask gemini AI to make an SVG file with the LaTeX command:
\pgfPT
sâmbătă, 28 noiembrie 2026
News : Release candidate: Godot 4.8 RC 1.
To all of our users in the States, we hope everyone had a wonderful Thanksgiving! There’s a lot to be thankful for in our community, and narrowing it down to only a single highlight or area would be a fools errand. Instead, let us express our thanks with something that everyone can enjoy: Godot 4.8’s first build of the Release Candidate stage. Being in this stage means that known critical regressions have been addressed, and all planned features have been fully locked-in.
See the official blogger.
vineri, 27 noiembrie 2026
Abonați-vă la:
Postări (Atom)

