I got super addicted to vidya games and put things on hold but my duo partner is out tonight so I went back to the muse thing. Turns out I was trying to sign up for regular muse for retards and not muse code.
That one just took my oculus account so I got in and started reading the docs and saw they have a local model! It is 19 gigs and I have an 11 gig gpu but I decided it might be fun to try it and watch my computer catch on fire.
Instead it just kinda started working. I have no idea how. It is using 9 gigs of gpu ram. The context is small (I didn't even know that was a thing) so my first few attempts it ran itself out thinking in circles.
I gave it a header file to my c gpu interface code I use in my games to talk to dxvk-native (which then talks to vulkan). Watching it try to figure out what to do was super entertaining:
--- File: GraphicsDevice.h ---
...
I've attached a header for a c file that calls into the dxvk-native graphics API. Could you create a similar .h and .c file that uses similar functionality but talks to the openGL ES graphics api?
We need create similar .h and .c file that uses similar functionality but talks to openGL ES graphics api.
We have header with functions. Need create similar header and implementation skeleton? Probably provide code.
The user wants similar .h and .c file that uses similar functionality but talks to openGL ES graphics api.
We should produce GraphicsDevice.h and GraphicsDevice.c (or .c). Provide mapping of D3D11 calls to OpenGL ES.
We need to consider OpenGL ES 3.x? Probably ES 3.0/3.1. Need to emulate functions.
The header has many functions: GD_Init, GD_Destroy, GetWidth etc, MakeTexture, CreateBufferWithData, CreateBuffer, CreateTexture, CreateTexture1D, CreateRenderTargetView, CreateDepthStencilView, shader creation, CreateInputLayout, rasterizer, sampler, blend, depth stencil, dispatch, draw, present, set states, etc.
We need similar API but using OpenGL ES. Could map D3D concepts to GL.
Maybe provide a stub implementation with comments. Could be large.
Better to produce a header with similar signatures but using GL types: GLuint, etc.
Probably provide GraphicsDevice_ES.h and GraphicsDevice_ES.c with analogous functions.
We need to keep similar functionality. Possibly map ID3D11* to GLuint handles.
We could define typedef struct GraphicsDevice_t { ... } with fields like EGLDisplay, EGLSurface, EGLContext, etc.
Simplify: Provide header with same function names but using GL types.
The request: Could you create a similar .h and .c file that uses similar functionality but talks to the openGL ES graphics api?
Probably produce both files.
We should not call tools? Could use get_datetime? No.
Maybe need to know OS? get_info for OS name? Not needed.
We can provide code.
We need to ensure code compiles? Probably pseudo.
Provide header with extern declarations using GLuint etc.
Map:
ID3D11RenderTargetView -> GLuint framebuffer? Or texture?
Simplify: keep same function names but parameters changed to GL types.
Better approach: Keep same API names but internally use GL. Could keep same signatures with D3D types? No, talks to OpenGL ES.
Probably create new API with similar naming but GL types.
Could create GraphicsDevice_GL.h with similar functions but using GLuint.
User asked similar .h and .c file that uses similar functionality but talks to openGL ES graphics api.
Might be okay to keep same function names but change types.
Let's design:
typedef struct GraphicsDevice_t GraphicsDevice;
extern bool GD_Init(GraphicsDevice **ppGD, const char *pWindowTitle, int posX, int posY, int w, int h, bool bRandomPos, int desiredGLVersion?);
But original has D3D_FEATURE_LEVEL desiredFeatureLevel. For GL ES, maybe int major/minor.
Simplify: keep same signature but ignore.
Probably best to provide a 1:1 mapping with comments.
Given complexity, provide skeleton with stubs returning success.
Provide header:
#pragma once
#include <stdint.h>
#include <stdbool.h>
#include <GL/es2/gl.h> or GLES3.
But OpenGL ES headers: <GLES3/gl3.h> etc.
We'll create GraphicsDevice_ES.h
Functions:
bool GD_Init(GraphicsDevice **ppGD, const char *pWindowTitle, int posX, int posY, int w, int h, bool bRandomPos, int glMajor, int glMinor);
void GD_Destroy(GraphicsDevice **ppGD);
int GD_GetWidth...
etc.
Resource creation:
GLuint GD_MakeTexture(GraphicsDevice *pGD, uint8_t **pRows, int w, int h, int rowPitch);
GLuint GD_CreateBufferWithData(GraphicsDevice *pGD, GLenum target, GLenum usage, const void *pData, size_t dataSize);
etc.
But original uses ID3D11Texture2D * etc. For GL, GLuint handle.
Maybe map ID3D11Texture2D* to GLuint.
We could define typedef GLuint ID3D11Texture2D; but confusing.
Better to create new API named GLESD... Hmm.
Alternative: Keep same function names but change return types to GLuint.
Probably acceptable.
Let's produce a reasonable implementation.
Since it's large, we can provide simplified stubs.
We should produce both .h and .c.
Given time, produce header with about same functions but using GL types.
Simplify: Use opaque handles.
Maybe define typedef GLuint GLTexture; etc.
Provide implementation with comments "TODO".
The user likely wants an example.
We can provide full header and c file with stubs.
Let's produce GraphicsDevice_ES.h
Include <stdint.h>, <stdbool.h>, <GLES3/gl3.h>, <GLES2/gl2ext.h>
Define struct.
Functions:
extern bool GD_Init(GraphicsDevice **ppGD, const char *pWindowTitle, int posX, int posY, int w, int h, bool bRandomPos, int glMajor, int glMinor);
extern void GD_Destroy(GraphicsDevice **ppGD);
extern int GD_GetWidth...
etc.
Resource creation:
extern GLuint GD_MakeTexture(...)
extern GLuint GD_CreateBufferWithData(...)
extern GLuint GD_CreateBuffer(...)
extern GLuint GD_CreateTexture(...)
extern GLuint GD_CreateTexture1D(...)
extern GLuint GD_CreateRenderTargetView(...) // returns framebuffer?
Hmm.
Maybe map RenderTargetView to framebuffer object.
Simplify: return GLuint for texture/buffer/framebuffer.
We could keep similar semantics.
Let's produce a plausible mapping:
ID3D11RenderTargetView -> GLuint (FBO)
ID3D11DepthStencilView -> GLuint (FBO with depth)
ID3D11VertexShader -> GLuint program? Actually shader program.
Better to keep simple: each D3D object maps to GLuint.
Provide stubs returning 0.
Also need GD_Present -> eglSwapBuffers.
GD_Dispatch -> glDispatchCompute (if ES 3.1)
GD_Draw -> glDrawArrays etc.
GD_Set states -> glUseProgram, glBindBuffer, etc.
Given huge API surface, provide skeleton.
Maybe we can use run_javascript to generate? No.
We can just output code.
Probably best to provide both files with comments explaining mapping.
Let's produce header:
#pragma once
#include <stdint.h>
#include <stdbool.h>
#include <GLES3/gl3.h>
typedef struct GraphicsDevice_t GraphicsDevice;
extern bool GD_Init(...);
...
Then .c file with struct definition containing EGLDisplay, EGLSurface, EGLContext, GLuint defaultFBO, int width, height, etc.
Implement Init to create window via EGL? Need platform specific. Might use GLFW? Simpler: assume EGL native window provided? Hmm.
Could just stub.
Maybe we can provide minimal implementation using EGL and EGL.
Given constraints, provide illustrative code.
User may expect similar functionality. Provide code with placeholders.
Let's produce final answer with two code blocks.
Make sure to note that OpenGL ES lacks some D3D features like input layout, rasterizer state etc, so map to gl state.
Provide mapping table.
Possibly keep same function signatures but using void* handles. But better to use GLuint.
Given the request, maybe they want same API names but implementation uses GL