mirror of https://github.com/bjornbytes/lovr.git
parent
7c7f8ed907
commit
16860e8ef5
|
@ -800,17 +800,6 @@ static int l_lovrGraphicsGetLimits(lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int l_lovrGraphicsGetStats(lua_State* L) {
|
||||
GraphicsStats stats;
|
||||
lovrGraphicsGetStats(&stats);
|
||||
lua_newtable(L);
|
||||
|
||||
lua_pushinteger(L, stats.pipelineSwitches), lua_setfield(L, -2, "pipelineSwitches");
|
||||
lua_pushinteger(L, stats.bundleSwitches), lua_setfield(L, -2, "bundleSwitches");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int l_lovrGraphicsIsFormatSupported(lua_State* L) {
|
||||
TextureFormat format = luax_checkenum(L, 1, TextureFormat, NULL);
|
||||
uint32_t features = 0;
|
||||
|
@ -1498,7 +1487,6 @@ static const luaL_Reg lovrGraphics[] = {
|
|||
{ "getDevice", l_lovrGraphicsGetDevice },
|
||||
{ "getFeatures", l_lovrGraphicsGetFeatures },
|
||||
{ "getLimits", l_lovrGraphicsGetLimits },
|
||||
{ "getStats", l_lovrGraphicsGetStats },
|
||||
{ "isFormatSupported", l_lovrGraphicsIsFormatSupported },
|
||||
{ "getWindowPass", l_lovrGraphicsGetWindowPass },
|
||||
{ "getDefaultFont", l_lovrGraphicsGetDefaultFont },
|
||||
|
|
|
@ -361,7 +361,6 @@ static struct {
|
|||
gpu_device_info device;
|
||||
gpu_features features;
|
||||
gpu_limits limits;
|
||||
GraphicsStats stats;
|
||||
Texture* window;
|
||||
Pass* windowPass;
|
||||
Font* defaultFont;
|
||||
|
@ -736,10 +735,6 @@ void lovrGraphicsGetLimits(GraphicsLimits* limits) {
|
|||
limits->pointSize = state.limits.pointSize;
|
||||
}
|
||||
|
||||
void lovrGraphicsGetStats(GraphicsStats* stats) {
|
||||
*stats = state.stats;
|
||||
}
|
||||
|
||||
bool lovrGraphicsIsFormatSupported(uint32_t format, uint32_t features) {
|
||||
uint8_t supports = state.features.formats[format];
|
||||
if (!features) return supports;
|
||||
|
@ -957,9 +952,6 @@ void lovrGraphicsSubmit(Pass** passes, uint32_t count) {
|
|||
|
||||
gpu_submit(streams, total);
|
||||
|
||||
state.stats.pipelineSwitches = 0;
|
||||
state.stats.bundleSwitches = 0;
|
||||
|
||||
state.stream = NULL;
|
||||
state.active = false;
|
||||
}
|
||||
|
@ -2857,8 +2849,6 @@ static void lovrModelReskin(Model* model) {
|
|||
gpu_compute(state.stream, (skin->vertexCount + subgroupSize - 1) / subgroupSize, 1, 1);
|
||||
gpu_compute_end(state.stream);
|
||||
baseVertex += skin->vertexCount;
|
||||
state.stats.pipelineSwitches++;
|
||||
state.stats.bundleSwitches++;
|
||||
}
|
||||
|
||||
state.hasReskin = true;
|
||||
|
@ -3040,8 +3030,6 @@ static void lovrTallyResolve(Tally* tally, uint32_t index, uint32_t count, gpu_b
|
|||
gpu_push_constants(stream, shader, &constants, sizeof(constants));
|
||||
gpu_compute(stream, (count + 31) / 32, 1, 1);
|
||||
gpu_compute_end(stream);
|
||||
state.stats.pipelineSwitches++;
|
||||
state.stats.bundleSwitches++;
|
||||
}
|
||||
|
||||
// Pass
|
||||
|
@ -4022,7 +4010,6 @@ static void flushPipeline(Pass* pass, Draw* draw, Shader* shader) {
|
|||
}
|
||||
|
||||
gpu_bind_pipeline(pass->stream, state.pipelines.data[index], false);
|
||||
state.stats.pipelineSwitches++;
|
||||
pipeline->dirty = false;
|
||||
}
|
||||
|
||||
|
@ -4055,7 +4042,6 @@ static void flushBindings(Pass* pass, Shader* shader) {
|
|||
gpu_bundle* bundle = getBundle(shader->layout);
|
||||
gpu_bundle_write(&bundle, &info, 1);
|
||||
gpu_bind_bundle(pass->stream, shader->gpu, set, bundle, NULL, 0);
|
||||
state.stats.bundleSwitches++;
|
||||
tempPop(stack);
|
||||
}
|
||||
|
||||
|
@ -4100,7 +4086,6 @@ static void flushBuiltins(Pass* pass, Draw* draw, Shader* shader) {
|
|||
gpu_bundle* bundle = getBundle(state.builtinLayout);
|
||||
gpu_bundle_write(&bundle, &bundleInfo, 1);
|
||||
gpu_bind_bundle(pass->stream, shader->gpu, 0, bundle, NULL, 0);
|
||||
state.stats.bundleSwitches++;
|
||||
}
|
||||
|
||||
float m[16];
|
||||
|
@ -4128,12 +4113,10 @@ static void flushBuiltins(Pass* pass, Draw* draw, Shader* shader) {
|
|||
static void flushMaterial(Pass* pass, Draw* draw, Shader* shader) {
|
||||
if (draw->material && draw->material != pass->pipeline->material) {
|
||||
gpu_bind_bundle(pass->stream, shader->gpu, 1, draw->material->bundle, NULL, 0);
|
||||
state.stats.bundleSwitches++;
|
||||
pass->materialDirty = true;
|
||||
} else if (pass->materialDirty) {
|
||||
Material* material = pass->pipeline->material ? pass->pipeline->material : state.defaultMaterial;
|
||||
gpu_bind_bundle(pass->stream, shader->gpu, 1, material->bundle, NULL, 0);
|
||||
state.stats.bundleSwitches++;
|
||||
pass->materialDirty = false;
|
||||
}
|
||||
}
|
||||
|
@ -5077,7 +5060,6 @@ void lovrPassCompute(Pass* pass, uint32_t x, uint32_t y, uint32_t z, Buffer* ind
|
|||
|
||||
if (pass->pipeline->dirty) {
|
||||
gpu_bind_pipeline(pass->stream, pipeline, true);
|
||||
state.stats.pipelineSwitches++;
|
||||
pass->pipeline->dirty = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -83,11 +83,6 @@ typedef struct {
|
|||
float pointSize;
|
||||
} GraphicsLimits;
|
||||
|
||||
typedef struct {
|
||||
uint32_t pipelineSwitches;
|
||||
uint32_t bundleSwitches;
|
||||
} GraphicsStats;
|
||||
|
||||
enum {
|
||||
TEXTURE_FEATURE_SAMPLE = (1 << 0),
|
||||
TEXTURE_FEATURE_FILTER = (1 << 1),
|
||||
|
@ -105,7 +100,6 @@ void lovrGraphicsDestroy(void);
|
|||
void lovrGraphicsGetDevice(GraphicsDevice* device);
|
||||
void lovrGraphicsGetFeatures(GraphicsFeatures* features);
|
||||
void lovrGraphicsGetLimits(GraphicsLimits* limits);
|
||||
void lovrGraphicsGetStats(GraphicsStats* stats);
|
||||
bool lovrGraphicsIsFormatSupported(uint32_t format, uint32_t features);
|
||||
void lovrGraphicsGetShaderCache(void* data, size_t* size);
|
||||
|
||||
|
|
Loading…
Reference in New Issue