Giter Site home page Giter Site logo

gfx's People

Contributors

akharyto-amd avatar alexanderveselov avatar gboisse avatar maoliver-amd avatar picul avatar skkkksdkfak avatar smeunier-amd avatar tgalaj-amd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

gfx's Issues

CMakeLists Error - Beginner

Hi,

Can I ask if there is any basic tutorial how to build the project using CMakeLists?

By default I get the following errors on Windows Visual Studio 2019 x64:

image

Compute Shader

Is this the right way to create a compute kernel?

 program = gfxCreateProgram(gfx, "myCompute");
 kernel = gfxCreateComputeKernel(gfx, program, "main");

Using RWByteAddressBuffer and ByteAddressBuffer

Host side:

byteBuffer = gfxCreateBuffer<uint32_t>(gfx, (nBytes / sizeof(uint32_t) + 1));
gfxProgramSetParameter(..., .., "byteBufferRW", byteBuffer);
gfxProgramSetParameter(..., .., "byteBuffer", byteBuffer);

Comp Shader:

RWByteAddressBuffer byteBufferRW;
byteBufferRW.Store(idx, value);

ByteAddressBuffer byteBuffer;
loadVal = byteBuffer.Load(idx);

value and loadVal aren't same. Seems like I am creating the byte addressable buffer wrong?

gfxBufferSetData

Hi, I would like to update a small buffer from CPU (every frame) and then use it in a compute shader.

I am not sure how to use buffers with kGfxCpuAccess_Write enabled.

Logging

gfx relies a lot on logging to report errors. When developing in Visual Studio or another IDE, we always can read the debug output but when the application is run by Pix or another tool, we can't anymore.

Ensuring a console is always available would be great.

Frame graph

gfx_scene.h is of great help for loading assets.

Some kind of gfx_frame_graph.h would help a lot of managing resources and developing/reusing/sharing render techniques (a set of render passes).

Requesting Non-PBR material support

Is it possible to extend materials to have kd, ks and shininess loaded from .mtl files? Tinyobjloader already loads these properties, just need support from gfx.

Alternatively, an approximate conversion from non-pbr to pbr would also help. e.g. metallicity = ks / (ks + kd) and roughness = sqrt(sqrt(2 / (2 + shininess))).

Simple example how to render a cube and add imgui buttons?

Hi, your tool/engine looks great, from https://twitter.com/ocornut/status/1371548539046727680
What are the plans for that tool?
I realize this is still early on, but I tried to create a simple 'hello world' but couldn't render a simple obj cube (and a ImGUI:Button)

Could you help? Here is the code:

#include "gfx_window.h"
#include "gfx_scene.h"
#include "gfx_imgui.h"

int main(int argc, char* argv[])
{
	GfxWindow window = gfxCreateWindow(1024, 768, "hello gfx");
	GfxContext context = gfxCreateContext(window);
	GfxScene scene  = gfxCreateScene();
	gfxImGuiInitialize(context);

	GfxResult res = gfxSceneImport(scene, "cube.obj");
	auto cam = gfxSceneCreateCamera(scene);
	gfxSceneSetActiveCamera(scene, cam);
	
	while (!gfxWindowIsCloseRequested(window))
	{
		GfxResult res = gfxWindowPumpEvents(window);
		
		// https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
		bool key = gfxWindowIsKeyDown(window, 0x42); 
		if (key)		{			printf("hi!\n");		}
		
		gfxFrame(context);
		
		gfxImGuiRender();
		
		gfxFinish(context);

	}

	gfxSceneClear(scene);
	gfxDestroyScene(scene);
	gfxDestroyContext(context);
	gfxDestroyWindow(window);
}

Add to CMakeLists.txt

add_executable(test test.cpp)
target_link_libraries(test gfx)

cube_obj.zip

Should gfxDestroy methods reset handles by default ?

Instead of the common pattern :

gfxDestroyTexture(gfx_, accumulationDIBuffer);
accumulationDIBuffer = {};

Just doing :

gfxDestroyTexture(gfx_, accumulationDIBuffer);

With :

GfxResult gfxDestroyTexture(GfxContext context, GfxTexture& texture)
{
    GfxInternal *gfx = GfxInternal::GetGfx(context);
    if(!gfx) return kGfxResult_InvalidParameter;
    GfxResult result = gfx->destroyTexture(texture);
    texture = {}; // maybe test result ? maybe reset in destroyTexture ?
    return result;
}

New glTF importer crashes when objects have no valid name

So, it seems that cgltf returns nullptr names on objects that have no valid name, which crashes std::string as they do not accept nullptr assignments (which is a really annoying thing if you ask me): c31f5ce (could cause the crash by trying to load the Sponza scene)

This ticket is mostly to track whether you think there's other places where this check should be added?

Going headless

How? Context creation offers two overloads - one asks for a window handle and the other asks for a D3D device handle. For headless mode, I guess we have to use the second overload using D3D device handle. However, I'm stuck at creating a D3D device.

I need some something simple: like: getMeADevice(int index), where index represents one of the several GPU adapters in the system. Please let me know!

As a side note: I can already decouple rendering resolution from display-frame-buffer resolution using custom render-targets or compute-shaders.

Dumping textures to file

Well, what are my options here?

I don't see a gfxCommandCopyTextureToBuffer(), but I can copy Gpu-Buffers to Cpu memory and access it for processing.

Maybe this is an option - copy texture (gpu) to gpu-buffer with a shader, then copy gpu-buffer to mapped cpu-memory?

Is there a better option?

Providing correct types for sharing constant buffer structures between C++ and HLSL

A common pattern for implementing constant buffer is to share a header between C++ and HLSL :

#ifndef GPU_SHARED_H
#define GPU_SHARED_H

#ifdef __cplusplus

#include <glm/gtx/type_aligned.hpp>
#include <glm/gtx/compatibility.hpp>

typedef uint32_t uint;

typedef glm::ivec2 int2;
typedef glm::ivec4 int4;

typedef glm::uvec2 uint2;
typedef glm::aligned_uvec3 uint3;
typedef glm::uvec4 uint4;

typedef glm::aligned_vec4 float4;
typedef glm::aligned_vec3 float3;
typedef glm::aligned_vec2 float2;

typedef glm::bool3 bool3;

typedef glm::mat4 float4x4;

#endif // __cplusplus

enum MyEnum
{
    VALUE1 = 0,
    VALUE2
};

struct MyContants
{
    float  attribute0;
    uint   attribute1;
    uint2  attribute2;
    uint   attribute3;
    uint   attribute4;
    MyEnum attribute5;
};

#endif // GPU_SHARED_H

These typedef declarations are probably wrong :

  • float2 and int2 don't match ?
  • what about bool3 ?
  • ...

HLSL contant buffer alignment rules aren't obvious, and we still can't use -not_use_legacy_cbuf_load with DXC.

I propose gfx provide a small set (subset?) of types we can use and arrange freely in constant buffers.

Array of textures

Hi,

I'm trying to do texture mapping using ray-query. Shader side code would look something like this -

myArrayOfTextures[giveMeMaterialIdx(committedInstanceIndex)].Load(uv)

As such, I need to create an array-of-textures. Texture2DArrays aren't helpful as all slices must have the same resolution. Any suggestions or alternatives?

Better leaked resource reporting

How could we keep some information (filename, line number...) about resources we create for providing more information when reporting leaks?

Pass shader defines in gfxCreate**Kernel

Hi,

This seems very trivial but I cannot set the value of a define when passing as compiler argument.

For example, how would you pass the following define as a createKernel argument?

#define MYDEFINE 64

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.