mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-11-14 07:45:06 +00:00
gs: Define shared limits and exclude mipmapper
This unifies the logic in GS::IndexBuffer and GS::VertexBuffer so that both can take the same amount of vertices. Additionally the limit for vertices was increased to 16777216 from 65536 to allow for proper models to be stored.
This commit is contained in:
parent
53568d445b
commit
4983e0ca06
3 changed files with 31 additions and 7 deletions
|
@ -40,12 +40,12 @@ SET(obs-stream-effects_HEADERS
|
||||||
"${PROJECT_SOURCE_DIR}/source/gs-helper.h"
|
"${PROJECT_SOURCE_DIR}/source/gs-helper.h"
|
||||||
"${PROJECT_SOURCE_DIR}/source/gs-effect.h"
|
"${PROJECT_SOURCE_DIR}/source/gs-effect.h"
|
||||||
"${PROJECT_SOURCE_DIR}/source/gs-indexbuffer.h"
|
"${PROJECT_SOURCE_DIR}/source/gs-indexbuffer.h"
|
||||||
"${PROJECT_SOURCE_DIR}/source/gs-mipmapper.h"
|
"${PROJECT_SOURCE_DIR}/source/gs-limits.h"
|
||||||
|
# "${PROJECT_SOURCE_DIR}/source/gs-mipmapper.h"
|
||||||
"${PROJECT_SOURCE_DIR}/source/gs-rendertarget.h"
|
"${PROJECT_SOURCE_DIR}/source/gs-rendertarget.h"
|
||||||
"${PROJECT_SOURCE_DIR}/source/gs-texture.h"
|
"${PROJECT_SOURCE_DIR}/source/gs-texture.h"
|
||||||
"${PROJECT_SOURCE_DIR}/source/gs-vertex.h"
|
"${PROJECT_SOURCE_DIR}/source/gs-vertex.h"
|
||||||
"${PROJECT_SOURCE_DIR}/source/gs-vertexbuffer.h"
|
"${PROJECT_SOURCE_DIR}/source/gs-vertexbuffer.h"
|
||||||
"${PROJECT_SOURCE_DIR}/source/gs-mipmapper.h"
|
|
||||||
"${PROJECT_BINARY_DIR}/source/version.h"
|
"${PROJECT_BINARY_DIR}/source/version.h"
|
||||||
"${PROJECT_SOURCE_DIR}/source/strings.h"
|
"${PROJECT_SOURCE_DIR}/source/strings.h"
|
||||||
"${PROJECT_SOURCE_DIR}/source/util-math.h"
|
"${PROJECT_SOURCE_DIR}/source/util-math.h"
|
||||||
|
@ -61,12 +61,11 @@ SET(obs-stream-effects_SOURCES
|
||||||
"${PROJECT_SOURCE_DIR}/source/gs-helper.cpp"
|
"${PROJECT_SOURCE_DIR}/source/gs-helper.cpp"
|
||||||
"${PROJECT_SOURCE_DIR}/source/gs-effect.cpp"
|
"${PROJECT_SOURCE_DIR}/source/gs-effect.cpp"
|
||||||
"${PROJECT_SOURCE_DIR}/source/gs-indexbuffer.cpp"
|
"${PROJECT_SOURCE_DIR}/source/gs-indexbuffer.cpp"
|
||||||
"${PROJECT_SOURCE_DIR}/source/gs-mipmapper.cpp"
|
# "${PROJECT_SOURCE_DIR}/source/gs-mipmapper.cpp"
|
||||||
"${PROJECT_SOURCE_DIR}/source/gs-rendertarget.cpp"
|
"${PROJECT_SOURCE_DIR}/source/gs-rendertarget.cpp"
|
||||||
"${PROJECT_SOURCE_DIR}/source/gs-texture.cpp"
|
"${PROJECT_SOURCE_DIR}/source/gs-texture.cpp"
|
||||||
"${PROJECT_SOURCE_DIR}/source/gs-vertex.cpp"
|
"${PROJECT_SOURCE_DIR}/source/gs-vertex.cpp"
|
||||||
"${PROJECT_SOURCE_DIR}/source/gs-vertexbuffer.cpp"
|
"${PROJECT_SOURCE_DIR}/source/gs-vertexbuffer.cpp"
|
||||||
"${PROJECT_SOURCE_DIR}/source/gs-mipmapper.cpp"
|
|
||||||
"${PROJECT_SOURCE_DIR}/source/util-math.cpp"
|
"${PROJECT_SOURCE_DIR}/source/util-math.cpp"
|
||||||
"${PROJECT_SOURCE_DIR}/source/util-memory.cpp"
|
"${PROJECT_SOURCE_DIR}/source/util-memory.cpp"
|
||||||
)
|
)
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "gs-indexbuffer.h"
|
#include "gs-indexbuffer.h"
|
||||||
|
#include "gs-limits.h"
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#pragma warning( push )
|
#pragma warning( push )
|
||||||
#pragma warning( disable: 4201 )
|
#pragma warning( disable: 4201 )
|
||||||
|
@ -25,8 +26,6 @@ extern "C" {
|
||||||
#pragma warning( pop )
|
#pragma warning( pop )
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint32_t defaultMaximumVertices = 65535u;
|
|
||||||
|
|
||||||
GS::IndexBuffer::IndexBuffer(uint32_t maximumVertices) {
|
GS::IndexBuffer::IndexBuffer(uint32_t maximumVertices) {
|
||||||
this->reserve(maximumVertices);
|
this->reserve(maximumVertices);
|
||||||
|
|
||||||
|
@ -35,7 +34,7 @@ GS::IndexBuffer::IndexBuffer(uint32_t maximumVertices) {
|
||||||
obs_leave_graphics();
|
obs_leave_graphics();
|
||||||
}
|
}
|
||||||
|
|
||||||
GS::IndexBuffer::IndexBuffer() : IndexBuffer(defaultMaximumVertices) {}
|
GS::IndexBuffer::IndexBuffer() : IndexBuffer(MAXIMUM_VERTICES) {}
|
||||||
|
|
||||||
GS::IndexBuffer::IndexBuffer(IndexBuffer& other) : IndexBuffer((uint32_t)other.size()) {
|
GS::IndexBuffer::IndexBuffer(IndexBuffer& other) : IndexBuffer((uint32_t)other.size()) {
|
||||||
std::copy(other.begin(), other.end(), this->end());
|
std::copy(other.begin(), other.end(), this->end());
|
||||||
|
|
26
source/gs-limits.h
Normal file
26
source/gs-limits.h
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
/*
|
||||||
|
* Modern effects for a modern Streamer
|
||||||
|
* Copyright (C) 2017 Michael Fabian Dirks
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
|
namespace GS {
|
||||||
|
static const uint32_t MAXIMUM_VERTICES = 0xFFFFFFu;
|
||||||
|
static const uint32_t MAXIMUM_UVW_LAYERS = 8u;
|
||||||
|
}
|
Loading…
Reference in a new issue