From 4983e0ca063fed0b6d4330d74cdc3faece628143 Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Thu, 18 Jan 2018 04:57:24 +0100 Subject: [PATCH] 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. --- CMakeLists.txt | 7 +++---- source/gs-indexbuffer.cpp | 5 ++--- source/gs-limits.h | 26 ++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 source/gs-limits.h diff --git a/CMakeLists.txt b/CMakeLists.txt index faa0596b..6dd6e465 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,12 +40,12 @@ SET(obs-stream-effects_HEADERS "${PROJECT_SOURCE_DIR}/source/gs-helper.h" "${PROJECT_SOURCE_DIR}/source/gs-effect.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-texture.h" "${PROJECT_SOURCE_DIR}/source/gs-vertex.h" "${PROJECT_SOURCE_DIR}/source/gs-vertexbuffer.h" - "${PROJECT_SOURCE_DIR}/source/gs-mipmapper.h" "${PROJECT_BINARY_DIR}/source/version.h" "${PROJECT_SOURCE_DIR}/source/strings.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-effect.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-texture.cpp" "${PROJECT_SOURCE_DIR}/source/gs-vertex.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-memory.cpp" ) diff --git a/source/gs-indexbuffer.cpp b/source/gs-indexbuffer.cpp index 8c308481..e47e95cb 100644 --- a/source/gs-indexbuffer.cpp +++ b/source/gs-indexbuffer.cpp @@ -18,6 +18,7 @@ */ #include "gs-indexbuffer.h" +#include "gs-limits.h" extern "C" { #pragma warning( push ) #pragma warning( disable: 4201 ) @@ -25,8 +26,6 @@ extern "C" { #pragma warning( pop ) } -const uint32_t defaultMaximumVertices = 65535u; - GS::IndexBuffer::IndexBuffer(uint32_t maximumVertices) { this->reserve(maximumVertices); @@ -35,7 +34,7 @@ GS::IndexBuffer::IndexBuffer(uint32_t maximumVertices) { obs_leave_graphics(); } -GS::IndexBuffer::IndexBuffer() : IndexBuffer(defaultMaximumVertices) {} +GS::IndexBuffer::IndexBuffer() : IndexBuffer(MAXIMUM_VERTICES) {} GS::IndexBuffer::IndexBuffer(IndexBuffer& other) : IndexBuffer((uint32_t)other.size()) { std::copy(other.begin(), other.end(), this->end()); diff --git a/source/gs-limits.h b/source/gs-limits.h new file mode 100644 index 00000000..6c54798a --- /dev/null +++ b/source/gs-limits.h @@ -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 + +namespace GS { + static const uint32_t MAXIMUM_VERTICES = 0xFFFFFFu; + static const uint32_t MAXIMUM_UVW_LAYERS = 8u; +} \ No newline at end of file